am 9ade11c1: Merge "SystemClock: use clock_gettime() on devices without /dev/alarm"
* commit '9ade11c1c57edaaf0b9be8a3cb9445ae7fed3337': SystemClock: use clock_gettime() on devices without /dev/alarm
This commit is contained in:
commit
d38ca369c0
1 changed files with 9 additions and 16 deletions
|
|
@ -119,22 +119,6 @@ int64_t elapsedRealtimeNano()
|
||||||
static volatile int prevMethod;
|
static volatile int prevMethod;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#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) {
|
|
||||||
timestamp = seconds_to_nanoseconds(ts.tv_sec) + ts.tv_nsec;
|
|
||||||
checkTimeStamps(timestamp, &prevTimestamp, &prevMethod,
|
|
||||||
METHOD_CLOCK_GETTIME);
|
|
||||||
return timestamp;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// CLOCK_BOOTTIME doesn't exist, fallback to /dev/alarm
|
|
||||||
static int s_fd = -1;
|
static int s_fd = -1;
|
||||||
|
|
||||||
if (s_fd == -1) {
|
if (s_fd == -1) {
|
||||||
|
|
@ -153,6 +137,15 @@ int64_t elapsedRealtimeNano()
|
||||||
return timestamp;
|
return timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /dev/alarm doesn't exist, fallback to CLOCK_BOOTTIME
|
||||||
|
result = clock_gettime(CLOCK_BOOTTIME, &ts);
|
||||||
|
if (result == 0) {
|
||||||
|
timestamp = seconds_to_nanoseconds(ts.tv_sec) + ts.tv_nsec;
|
||||||
|
checkTimeStamps(timestamp, &prevTimestamp, &prevMethod,
|
||||||
|
METHOD_CLOCK_GETTIME);
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
// XXX: there was an error, probably because the driver didn't
|
// XXX: there was an error, probably because the driver didn't
|
||||||
// exist ... this should return
|
// exist ... this should return
|
||||||
// a real error, like an exception!
|
// a real error, like an exception!
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue