X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=backend.c;h=3df0133f3e56d1c2648580fccaf1b870847992f4;hp=3424a0982b534bc60b8ea037814427e9156b929f;hb=03be65c96360db94cde247bd46f523dfe5e61d12;hpb=66b6c5efc84f1a5fb25648f38409716682bad84c diff --git a/backend.c b/backend.c index 3424a098..3df0133f 100644 --- a/backend.c +++ b/backend.c @@ -2104,12 +2104,20 @@ static void *helper_thread_main(void *data) uint64_t sec = DISK_UTIL_MSEC / 1000; uint64_t nsec = (DISK_UTIL_MSEC % 1000) * 1000000; struct timespec ts; + +#if defined(CONFIG_CLOCK_MONOTONIC) + clock_gettime(CLOCK_MONOTONIC, &ts); + ts.tv_sec += sec; + ts.tv_nsec += nsec; +#else struct timeval tv; gettimeofday(&tv, NULL); ts.tv_sec = tv.tv_sec + sec; ts.tv_nsec = (tv.tv_usec * 1000) + nsec; - if (ts.tv_nsec > 1000000000ULL) { +#endif + + if (ts.tv_nsec >= 1000000000ULL) { ts.tv_nsec -= 1000000000ULL; ts.tv_sec++; }