X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=gettime.c;h=136c02c15af797bc9057ea10a1511f1d79e856a4;hp=161240eeedbbcee0107bfc92a5c1fa7e94954915;hb=4241ea8fb0606f9bd5b7ed1278d3b7825883acf6;hpb=1e97cce9f5a87a67293a05ec4533ed6968698b2e diff --git a/gettime.c b/gettime.c index 161240ee..136c02c1 100644 --- a/gettime.c +++ b/gettime.c @@ -6,11 +6,10 @@ #include #include "fio.h" -#include "os.h" #include "hash.h" -static int clock_gettime_works = 1; +static int clock_gettime_works = 0; #ifdef FIO_DEBUG_TIME @@ -113,26 +112,18 @@ void fio_gettime(struct timeval *tp, void fio_unused *caller) gtod_log_caller(caller); #endif -repeat: - if (!clock_gettime_works) + if (!clock_gettime_works) { +gtod: gettimeofday(tp, NULL); - else { + } else { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0) { clock_gettime_works = 0; - goto repeat; + goto gtod; } tp->tv_sec = ts.tv_sec; tp->tv_usec = ts.tv_nsec / 1000; } } - -static void fio_init check_clock(void) -{ - struct timespec ts; - - if (clock_getres(CLOCK_MONOTONIC, &ts) < 0) - clock_gettime_works = 0; -}