gettime: Introduce rel_time_since()
[fio.git] / helper_thread.c
index ad1a08f32b6a773e7b4fe83bbc8b1d02bb5e9727..c5ca23e0640197e07043697b0c3be125e6f78609 100644 (file)
@@ -169,11 +169,7 @@ static void *helper_thread_main(void *data)
        }
 #endif
 
-#ifdef CONFIG_PTHREAD_CONDATTR_SETCLOCK
-       clock_gettime(CLOCK_MONOTONIC, &ts);
-#else
-       clock_gettime(CLOCK_REALTIME, &ts);
-#endif
+       fio_get_mono_time(&ts);
        memcpy(&last_du, &ts, sizeof(ts));
        memcpy(&last_ss, &ts, sizeof(ts));
        memcpy(&last_si, &ts, sizeof(ts));
@@ -194,20 +190,17 @@ static void *helper_thread_main(void *data)
                        FD_SET(hd->pipe[0], &rfds);
                        FD_ZERO(&efds);
                        FD_SET(hd->pipe[0], &efds);
-                       ret = select(1, &rfds, NULL, &efds, &timeout);
-                       if (ret < 0)
+                       if (select(1, &rfds, NULL, &efds, &timeout) < 0) {
                                log_err("fio: select() call in helper thread failed: %s",
                                        strerror(errno));
+                               ret = 1;
+                       }
                        if (read_from_pipe(hd->pipe[0], &action, sizeof(action)) <
                            0)
                                action = 0;
                }
 
-#ifdef CONFIG_PTHREAD_CONDATTR_SETCLOCK
-               clock_gettime(CLOCK_MONOTONIC, &ts);
-#else
-               clock_gettime(CLOCK_REALTIME, &ts);
-#endif
+               fio_get_mono_time(&ts);
 
                if (action == A_RESET) {
                        last_du = ts;