fixed: use CLOCK_MONOTONIC for timing info, since gettimeofday is affected by ntp...
authorBob van Loosen <bob.loosen@gmail.com>
Sun, 26 Feb 2012 22:03:13 +0000 (23:03 +0100)
committerBob van Loosen <bob.loosen@gmail.com>
Sun, 26 Feb 2012 22:36:32 +0000 (23:36 +0100)
src/lib/platform/util/timeutils.h

index 3b1ef700c8f4213ca1a1f2af3ee15e5e6f5d71e7..b886f88a1cd58511b5cf03d9088af3456f6d54ac 100644 (file)
@@ -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
   }