Use CLOCK_MONOTONIC if we can
authorJens Axboe <axboe@kernel.dk>
Fri, 3 Feb 2012 11:48:16 +0000 (12:48 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 3 Feb 2012 11:48:16 +0000 (12:48 +0100)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
gettime.c

index 72fda3f..15356b1 100644 (file)
--- a/gettime.c
+++ b/gettime.c
@@ -140,7 +140,11 @@ void fio_gettime(struct timeval *tp, void fio_unused *caller)
        case CS_CGETTIME: {
                struct timespec ts;
 
+#ifdef FIO_HAVE_CLOCK_MONOTONIC
+               if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0) {
+#else
                if (clock_gettime(CLOCK_REALTIME, &ts) < 0) {
+#endif
                        log_err("fio: clock_gettime fails\n");
                        assert(0);
                }