ref: cf4b381ac772978b3179657475b9fdfb8b17c629
parent: eaa3be9a841943389f43991c3edabde54f62350f
author: Jan Beich <jbeich@FreeBSD.org>
date: Fri Nov 22 17:06:58 EST 2019
tools: prefer mach_absolute_time on macOS for forward compatibility
--- a/tools/dav1d.c
+++ b/tools/dav1d.c
@@ -63,14 +63,14 @@
LARGE_INTEGER t;
QueryPerformanceCounter(&t);
return 1000000000 * t.QuadPart / frequency.QuadPart;
-#elif defined(HAVE_CLOCK_GETTIME)
- struct timespec ts;
- clock_gettime(CLOCK_MONOTONIC, &ts);
- return 1000000000ULL * ts.tv_sec + ts.tv_nsec;
#elif defined(__APPLE__)
mach_timebase_info_data_t info;
mach_timebase_info(&info);
return mach_absolute_time() * info.numer / info.denom;
+#elif defined(HAVE_CLOCK_GETTIME)
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ return 1000000000ULL * ts.tv_sec + ts.tv_nsec;
#endif
}