diff options
| author | Narayan Kamath <narayan@google.com> | 2014-04-10 18:40:55 +0100 |
|---|---|---|
| committer | Narayan Kamath <narayan@google.com> | 2014-04-10 20:19:20 +0100 |
| commit | ea659643ee1b0c46e473619034cd130440405ac4 (patch) | |
| tree | 91b747125fdd6738a2826f75628cf945d6431912 /libutils | |
| parent | 472e04f2b4b1870f8be789a3f16c2abb664b731a (diff) | |
| download | system_core-ea659643ee1b0c46e473619034cd130440405ac4.tar.gz system_core-ea659643ee1b0c46e473619034cd130440405ac4.tar.bz2 system_core-ea659643ee1b0c46e473619034cd130440405ac4.zip | |
HAVE_POSIX_CLOCKS doesn't imply CLOCK_BOOTTIME.
HAVE_POSIX_CLOCKS imples clock_gettime,settime and
CLOCK_REALTIME / CLOCK_MONOTONIC.
CLOCK_BOOTTIME appears only on newer versions of glibc
and might only be supported on newer kernels.
Change-Id: I66e724a3593538c3b80de2c5f81a964d3fa96eaf
Diffstat (limited to 'libutils')
| -rw-r--r-- | libutils/Timers.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libutils/Timers.cpp b/libutils/Timers.cpp index 5293cd2a8..a431e9232 100644 --- a/libutils/Timers.cpp +++ b/libutils/Timers.cpp @@ -34,7 +34,7 @@ nsecs_t systemTime(int clock) { -#if defined(HAVE_POSIX_CLOCKS) +#if defined(HAVE_ANDROID_OS) static const clockid_t clocks[] = { CLOCK_REALTIME, CLOCK_MONOTONIC, @@ -47,7 +47,9 @@ nsecs_t systemTime(int clock) clock_gettime(clocks[clock], &t); return nsecs_t(t.tv_sec)*1000000000LL + t.tv_nsec; #else - // we don't support the clocks here. + // Clock support varies widely across hosts. Mac OS doesn't support + // posix clocks, older glibcs don't support CLOCK_BOOTTIME and Windows + // is windows. struct timeval t; t.tv_sec = t.tv_usec = 0; gettimeofday(&t, NULL); |
