From 768adc07743c4121216fdca0d8b4a0d7184ebd3c Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Tue, 21 Jan 2020 18:57:16 -0800 Subject: [PATCH 1/2] Fix timefn on android --- programs/timefn.c | 2 +- programs/timefn.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/programs/timefn.c b/programs/timefn.c index 096e1910b..4025063eb 100644 --- a/programs/timefn.c +++ b/programs/timefn.c @@ -84,7 +84,7 @@ PTime UTIL_getSpanTimeNano(UTIL_time_t clockStart, UTIL_time_t clockEnd) #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 */ + && defined(TIME_UTC) && !defined(__ANDROID__) /* 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 b156a33b6..0f2b12ce8 100644 --- a/programs/timefn.h +++ b/programs/timefn.h @@ -52,7 +52,7 @@ extern "C" { #define UTIL_TIME_INITIALIZER 0 #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 */ + && defined(TIME_UTC) && !defined(__ANDROID__) /* C11 requires timespec_get, but FreeBSD 11 lacks it, while still claiming C11 compliance */ typedef struct timespec UTIL_time_t; #define UTIL_TIME_INITIALIZER { 0, 0 } From 7ec87cfb28d389b946452bd74dac884ace542f13 Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Wed, 22 Jan 2020 11:17:30 -0800 Subject: [PATCH 2/2] Update comment in timefn --- programs/timefn.c | 5 +++-- programs/timefn.h | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/programs/timefn.c b/programs/timefn.c index 4025063eb..8d92b3a70 100644 --- a/programs/timefn.c +++ b/programs/timefn.c @@ -82,9 +82,10 @@ PTime UTIL_getSpanTimeNano(UTIL_time_t clockStart, UTIL_time_t clockEnd) } - +/* C11 requires timespec_get, but FreeBSD 11 lacks it, while still claiming C11 compliance. + Android also lacks it but does define TIME_UTC. */ #elif (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */) \ - && defined(TIME_UTC) && !defined(__ANDROID__) /* C11 requires timespec_get, but FreeBSD 11 lacks it, while still claiming C11 compliance */ + && defined(TIME_UTC) && !defined(__ANDROID__) #include /* abort */ #include /* perror */ diff --git a/programs/timefn.h b/programs/timefn.h index 0f2b12ce8..7636f1f4d 100644 --- a/programs/timefn.h +++ b/programs/timefn.h @@ -51,8 +51,10 @@ extern "C" { typedef PTime UTIL_time_t; #define UTIL_TIME_INITIALIZER 0 +/* C11 requires timespec_get, but FreeBSD 11 lacks it, while still claiming C11 compliance. + Android also lacks it but does define TIME_UTC. */ #elif (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */) \ - && defined(TIME_UTC) && !defined(__ANDROID__) /* C11 requires timespec_get, but FreeBSD 11 lacks it, while still claiming C11 compliance */ + && defined(TIME_UTC) && !defined(__ANDROID__) typedef struct timespec UTIL_time_t; #define UTIL_TIME_INITIALIZER { 0, 0 }