summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2017-09-24 02:47:07 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2017-09-24 02:47:07 (GMT)
commite70dc43d6bfea81a565e3b420795bd351112458e (patch)
tree52ff1e3bee6e6d2481863c7367e69844f412d67c /src
parent6718b90009d537e15574f30c9ce4c40477b9d1ae (diff)
downloadhdf5-e70dc43d6bfea81a565e3b420795bd351112458e.zip
hdf5-e70dc43d6bfea81a565e3b420795bd351112458e.tar.gz
hdf5-e70dc43d6bfea81a565e3b420795bd351112458e.tar.bz2
Update H5_now_usec to prefer using clock_gettime.
Diffstat (limited to 'src')
-rw-r--r--src/H5timer.c9
1 files changed, 8 insertions, 1 deletions
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;