Makefile: Suppress `-Wimplicit-fallthrough` when compiling `lex.yy`
[fio.git] / time.c
diff --git a/time.c b/time.c
index cd0e2a89144b59a565d88fab6192dda951a8ff2b..5c4d6de0399c5cc681e9ca362c019870baf9db98 100644 (file)
--- a/time.c
+++ b/time.c
@@ -172,14 +172,14 @@ void set_genesis_time(void)
        fio_gettime(&genesis, NULL);
 }
 
-void set_epoch_time(struct thread_data *td, int log_unix_epoch)
+void set_epoch_time(struct thread_data *td, int log_alternate_epoch, clockid_t clock_id)
 {
        fio_gettime(&td->epoch, NULL);
-       if (log_unix_epoch) {
-               struct timeval tv;
-               gettimeofday(&tv, NULL);
-               td->unix_epoch = (unsigned long long)(tv.tv_sec) * 1000 +
-                                (unsigned long long)(tv.tv_usec) / 1000;
+       if (log_alternate_epoch) {
+               struct timespec ts;
+               clock_gettime(clock_id, &ts);
+               td->alternate_epoch = (unsigned long long)(ts.tv_sec) * 1000 +
+                                (unsigned long long)(ts.tv_nsec) / 1000000;
        }
 }