- if (gettimeofday(&tv, NULL) != 0)
- return 0;
- thetime = ((cycles_t)tv.tv_sec) * 1000000ULL + ((cycles_t)tv.tv_usec);
- return (cycles_t)thetime;
+ if (caa_unlikely(clock_gettime(CLOCK_MONOTONIC, &ts)))
+ return -1ULL;
+ return ((uint64_t) ts.tv_sec * 1000000000ULL) + ts.tv_nsec;