* commit 'e7ddcad89f2950d58b4022b55f2cf693daac2e19': HAVE_POSIX_CLOCKS doesn't imply CLOCK_BOOTTIME.
This commit is contained in:
commit
48030e68e5
1 changed files with 4 additions and 2 deletions
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
nsecs_t systemTime(int clock)
|
nsecs_t systemTime(int clock)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_POSIX_CLOCKS)
|
#if defined(HAVE_ANDROID_OS)
|
||||||
static const clockid_t clocks[] = {
|
static const clockid_t clocks[] = {
|
||||||
CLOCK_REALTIME,
|
CLOCK_REALTIME,
|
||||||
CLOCK_MONOTONIC,
|
CLOCK_MONOTONIC,
|
||||||
|
|
@ -47,7 +47,9 @@ nsecs_t systemTime(int clock)
|
||||||
clock_gettime(clocks[clock], &t);
|
clock_gettime(clocks[clock], &t);
|
||||||
return nsecs_t(t.tv_sec)*1000000000LL + t.tv_nsec;
|
return nsecs_t(t.tv_sec)*1000000000LL + t.tv_nsec;
|
||||||
#else
|
#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;
|
struct timeval t;
|
||||||
t.tv_sec = t.tv_usec = 0;
|
t.tv_sec = t.tv_usec = 0;
|
||||||
gettimeofday(&t, NULL);
|
gettimeofday(&t, NULL);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue