time: use monotonic_clock
monotonic is unaffected by system time changes
This commit is contained in:
parent
803ec2cacc
commit
31b3e5ab68
2
time.cpp
2
time.cpp
@ -56,7 +56,7 @@ util::sleep (uint64_t ns) {
|
|||||||
uint64_t
|
uint64_t
|
||||||
util::nanoseconds (void) {
|
util::nanoseconds (void) {
|
||||||
struct timespec t;
|
struct timespec t;
|
||||||
clock_gettime (CLOCK_REALTIME, &t);
|
clock_gettime (CLOCK_MONOTONIC, &t);
|
||||||
|
|
||||||
CHECK_SOFT (t.tv_sec > 0);
|
CHECK_SOFT (t.tv_sec > 0);
|
||||||
CHECK_SOFT (t.tv_nsec > 0);
|
CHECK_SOFT (t.tv_nsec > 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user