+
+unsigned long mtime_since_genesis(void)
+{
+ return mtime_since_now(&genesis);
+}
+
+static void fio_init time_init(void)
+{
+ int i;
+
+ /*
+ * Check the granularity of the nanosleep function
+ */
+ for (i = 0; i < 10; i++) {
+ struct timeval tv;
+ struct timespec ts;
+ unsigned long elapsed;
+
+ fio_gettime(&tv, NULL);
+ ts.tv_sec = 0;
+ ts.tv_nsec = 1000;
+
+ nanosleep(&ts, NULL);
+ elapsed = utime_since_now(&tv);
+
+ if (elapsed > ns_granularity)
+ ns_granularity = elapsed;
+ }
+}
+
+void set_genesis_time(void)
+{
+ fio_gettime(&genesis, NULL);
+}
+
+void fill_start_time(struct timeval *t)
+{
+ memcpy(t, &genesis, sizeof(genesis));
+}