Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c9244720 authored by Greg Hackmann's avatar Greg Hackmann
Browse files

open("/dev/rtc0") failure in AlarmManagerService.setTime() should be non-fatal



Setting the time-of-day clock is still useful on systems where the RTC
device is not yet brought up or otherwise unavailable.  This matches the
in-kernel behavior of the Android alarm driver.

Change-Id: I6d4fdadab12e241ada7419425efd55bd13873c55
Signed-off-by: default avatarGreg Hackmann <ghackmann@google.com>
parent 38bf5146
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -164,16 +164,16 @@ int AlarmImplTimerFd::setTime(struct timeval *tv)
    int fd;
    int res;

    fd = open("/dev/rtc0", O_RDWR);
    if (fd < 0) {
        ALOGV("Unable to open RTC driver: %s\n", strerror(errno));
        return -1;
    }

    res = settimeofday(tv, NULL);
    if (res < 0) {
        ALOGV("settimeofday() failed: %s\n", strerror(errno));
        goto done;
        return -1;
    }

    fd = open("/dev/rtc0", O_RDWR);
    if (fd < 0) {
        ALOGV("Unable to open RTC driver: %s\n", strerror(errno));
        return res;
    }

    gmtime_res = gmtime_r(&tv->tv_sec, &tm);