From: Bob van Loosen Date: Sun, 26 Feb 2012 22:03:13 +0000 (+0100) Subject: fixed: use CLOCK_MONOTONIC for timing info, since gettimeofday is affected by ntp... X-Git-Tag: upstream/2.2.0~1^2~33^2~30 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=c4609291c334e2f5f5b87b8dc37e68a958bfb378;p=deb_libcec.git fixed: use CLOCK_MONOTONIC for timing info, since gettimeofday is affected by ntp and by manually adjusting the system time --- 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 }