]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fix #911 : changed detection macro for clock_gettime()
authorYann Collet <cyan@fb.com>
Mon, 4 Dec 2017 23:57:01 +0000 (15:57 -0800)
committerYann Collet <cyan@fb.com>
Mon, 4 Dec 2017 23:57:01 +0000 (15:57 -0800)
The new macro might be a bit too restrictive.
Systems which do not support new test will simply default to <time.h>'s `clock_t clock()`,
suffering lesser benchmark accuracy.
Should it matter, the detection macro will have to be upgraded.

programs/util.h

index 37098f2f7256d455982940faf4ead17a297914cb..f510bc5e0e8ca1d1c1bfc8c10882248508b7ceab 100644 (file)
@@ -168,7 +168,7 @@ static int g_utilDisplayLevel;
         }
         return ((clockEnd - clockStart) * (U64)rate.numer) / ((U64)rate.denom);
     }
-#elif (PLATFORM_POSIX_VERSION >= 200112L)
+#elif defined __UCLIBC__ || ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 17) || __GLIBC__ > 2)
     #include <time.h>
     #define UTIL_TIME_INITIALIZER { 0, 0 }
     typedef struct timespec UTIL_freq_t;