]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
moved C11 code path to timespec_get
authorYann Collet <cyan@fb.com>
Wed, 10 Apr 2019 21:15:11 +0000 (14:15 -0700)
committerYann Collet <cyan@fb.com>
Wed, 10 Apr 2019 21:15:11 +0000 (14:15 -0700)
programs/timefn.c

index cb545ad67d9f185a7f43ee91f53f4fd947d057f2..8c6010c9035aac60368d0ddfde3fa0d412a6bbaf 100644 (file)
@@ -11,9 +11,6 @@
 
 /* ===  Dependencies  === */
 
-#include <stdlib.h>   /* abort */
-#include <stdio.h>    /* perror */
-
 #include "timefn.h"
 
 
@@ -23,6 +20,9 @@
 
 #if defined(_WIN32)   /* Windows */
 
+#include <stdlib.h>   /* abort */
+#include <stdio.h>    /* perror */
+
 UTIL_time_t UTIL_getTime(void) { UTIL_time_t x; QueryPerformanceCounter(&x); return x; }
 
 PTime UTIL_getSpanTimeMicro(UTIL_time_t clockStart, UTIL_time_t clockEnd)
@@ -83,14 +83,16 @@ PTime UTIL_getSpanTimeNano(UTIL_time_t clockStart, UTIL_time_t clockEnd)
 
 
 
-#elif (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */) \
-    && defined (CLOCK_MONOTONIC)
+#elif (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */)
+
+#include <stdlib.h>   /* abort */
+#include <stdio.h>    /* perror */
 
 UTIL_time_t UTIL_getTime(void)
 {
     UTIL_time_t time;
-    if (clock_gettime(CLOCK_MONOTONIC, &time)) {
-        perror("timefb::clock_gettime");
+    if (timespec_get(&time, TIME_UTC) == 0) {
+        perror("timefn::timespec_get");
         abort();
     }
     return time;