From c4609291c334e2f5f5b87b8dc37e68a958bfb378 Mon Sep 17 00:00:00 2001 From: Bob van Loosen Date: Sun, 26 Feb 2012 23:03:13 +0100 Subject: [PATCH] fixed: use CLOCK_MONOTONIC for timing info, since gettimeofday is affected by ntp and by manually adjusting the system time --- src/lib/platform/util/timeutils.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/platform/util/timeutils.h b/src/lib/platform/util/timeutils.h index 3b1ef70..b886f88 100644 --- a/src/lib/platform/util/timeutils.h +++ b/src/lib/platform/util/timeutils.h @@ -92,9 +92,9 @@ namespace PLATFORM } return -1; #else - timeval time; - gettimeofday(&time, NULL); - return (int64_t) (time.tv_sec * 1000 + time.tv_usec / 1000); + timespec time; + clock_gettime(CLOCK_MONOTONIC, &time); + return (int64_t)time.tv_sec * 1000 + time.tv_nsec / 1000000; #endif } -- 2.34.1