From e70dc43d6bfea81a565e3b420795bd351112458e Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 23 Sep 2017 21:47:07 -0500 Subject: Update H5_now_usec to prefer using clock_gettime. --- src/H5timer.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/H5timer.c b/src/H5timer.c index 2cb8cea..4a1f3f0 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -193,7 +193,14 @@ H5_now_usec(void) { uint64_t now; /* Current time, in microseconds */ -#ifdef H5_HAVE_GETTIMEOFDAY +#if defined(H5_HAVE_CLOCK_GETTIME) + { + struct timespec ts; + + HDclock_gettime(CLOCK_MONOTONIC, &ts); + now = (uint64_t)(ts.tv_sec * (1000 * 1000)) + (uint64_t)(ts.tv_nsec * 1000); + } +#elif defined(H5_HAVE_GETTIMEOFDAY) { struct timeval now_tv; -- cgit v0.12