time: use monotonic_clock

monotonic is unaffected by system time changes
This commit is contained in:
Danny Robson 2015-01-19 19:11:57 +11:00
parent 803ec2cacc
commit 31b3e5ab68

View File

@ -56,7 +56,7 @@ util::sleep (uint64_t ns) {
uint64_t
util::nanoseconds (void) {
struct timespec t;
clock_gettime (CLOCK_REALTIME, &t);
clock_gettime (CLOCK_MONOTONIC, &t);
CHECK_SOFT (t.tv_sec > 0);
CHECK_SOFT (t.tv_nsec > 0);