gettime: improve gettimeofday() offload support
[fio.git] / gettime-thread.c
index 3d49034a72792fc6cfc590ed545c522de4f7a999..72cc4d8a472783f7e73d7d40f8a8da9f56759a2a 100644 (file)
@@ -20,8 +20,15 @@ void fio_gtod_init(void)
 
 static void fio_gtod_update(void)
 {
-       if (fio_tv)
-               gettimeofday(fio_tv, NULL);
+       if (fio_tv) {
+               struct timeval __tv;
+
+               gettimeofday(&__tv, NULL);
+               fio_tv->tv_sec = __tv.tv_sec;
+               write_barrier();
+               fio_tv->tv_usec = __tv.tv_usec;
+               write_barrier();
+       }
 }
 
 static void *gtod_thread_main(void *data)