From 855e2f0d89030e229bc8f474eddc329dcb6a488e Mon Sep 17 00:00:00 2001 From: Jim Huang Date: Mon, 24 Jun 2019 23:54:38 +0800 Subject: [PATCH] Use clock_gettime() instead of timespec_get() clock_gettime(CLOCK_REALTIME, &ts) is equivalent to timespec_get(&ts, TIME_UTC) in C11. It has the advantage that avoids the following building error when building with macOS: warning: 'timespec_get' is only available on macOS 10.15 or newer [-Wunguarded-availability-new] --- src/stats.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stats.c b/src/stats.c index 807ef5f0..46bb1653 100644 --- a/src/stats.c +++ b/src/stats.c @@ -312,10 +312,10 @@ static double mi_clock_now() { } #else #include -#ifdef TIME_UTC +#ifdef CLOCK_REALTIME static double mi_clock_now() { struct timespec t; - timespec_get(&t, TIME_UTC); + clock_gettime(CLOCK_REALTIME, &t); return (double)t.tv_sec + (1.0e-9 * (double)t.tv_nsec); } #else