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

Commit 6523a82c authored by Ben Cheng's avatar Ben Cheng Committed by Android Git Automerger
Browse files

am 70f93fb5: Merge "Disable the use of clock_gettime for now." into jb-mr1-dev

* commit '70f93fb5':
  Disable the use of clock_gettime for now.
parents 015a6f2d 70f93fb5
Loading
Loading
Loading
Loading
+9 −1
Original line number Original line Diff line number Diff line
@@ -153,17 +153,25 @@ int64_t elapsedRealtimeNano()
{
{
#ifdef HAVE_ANDROID_OS
#ifdef HAVE_ANDROID_OS
    struct timespec ts;
    struct timespec ts;
    int result = clock_gettime(CLOCK_BOOTTIME, &ts);
    int result;
    int64_t timestamp;
    int64_t timestamp;
    static volatile int64_t prevTimestamp;
    static volatile int64_t prevTimestamp;
    static volatile int prevMethod;
    static volatile int prevMethod;


#if 0
    /*
     * b/7100774
     * clock_gettime appears to have clock skews and can sometimes return
     * backwards values. Disable its use until we find out what's wrong.
     */
    result = clock_gettime(CLOCK_BOOTTIME, &ts);
    if (result == 0) {
    if (result == 0) {
        timestamp = seconds_to_nanoseconds(ts.tv_sec) + ts.tv_nsec;
        timestamp = seconds_to_nanoseconds(ts.tv_sec) + ts.tv_nsec;
        checkTimeStamps(timestamp, &prevTimestamp, &prevMethod,
        checkTimeStamps(timestamp, &prevTimestamp, &prevMethod,
                        METHOD_CLOCK_GETTIME);
                        METHOD_CLOCK_GETTIME);
        return timestamp;
        return timestamp;
    }
    }
#endif


    // CLOCK_BOOTTIME doesn't exist, fallback to /dev/alarm
    // CLOCK_BOOTTIME doesn't exist, fallback to /dev/alarm
    static int s_fd = -1;
    static int s_fd = -1;