diff --git a/programs/timefn.c b/programs/timefn.c index 8c6010c90..21f2a9618 100644 --- a/programs/timefn.c +++ b/programs/timefn.c @@ -83,7 +83,8 @@ PTime UTIL_getSpanTimeNano(UTIL_time_t clockStart, UTIL_time_t clockEnd) -#elif (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */) +#elif (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */) \ + && defined(TIME_UTC) /* C11 requires timespec_get, but FreeBSD 11 lacks it, while still claiming C11 compliance */ #include /* abort */ #include /* perror */ diff --git a/programs/timefn.h b/programs/timefn.h index 810d6b262..d1ddd31b1 100644 --- a/programs/timefn.h +++ b/programs/timefn.h @@ -57,9 +57,10 @@ extern "C" { typedef PTime UTIL_time_t; #define UTIL_TIME_INITIALIZER 0 -#elif (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */) +#elif (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */) \ + && defined(TIME_UTC) /* C11 requires timespec_get, but FreeBSD 11 lacks it, while still claiming C11 compliance */ - typedef struct timespec UTIL_time_t; /* C11 defines struct timespes within time.h */ + typedef struct timespec UTIL_time_t; #define UTIL_TIME_INITIALIZER { 0, 0 } #else /* relies on standard C90 (note : clock_t measurements can be wrong when using multi-threading) */