From 24ef6fe4e98363a97d0a729673d27ffebaed7cb2 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Wed, 26 Oct 2016 10:13:15 -0700 Subject: Fix build on XCode 8 w/OSX 10.12 SDK CLOCK_REALTIME (along with clock_gettime and friends) are now defined, so the build fails with a redefinition error. Test: m checkbuild (w/XCode 8 on 10.11 with 10.12 SDK) Change-Id: Ic8a5cc872ded1766597fda5f098d0e044cd063ee --- runtime/base/time_utils.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/base/time_utils.h b/runtime/base/time_utils.h index 55d2764576..383b52fb33 100644 --- a/runtime/base/time_utils.h +++ b/runtime/base/time_utils.h @@ -73,9 +73,11 @@ static constexpr inline uint64_t MsToNs(uint64_t ms) { } #if defined(__APPLE__) -// No clocks to specify on OS/X, fake value to pass to routines that require a clock. +#ifndef CLOCK_REALTIME +// No clocks to specify on OS/X < 10.12, fake value to pass to routines that require a clock. #define CLOCK_REALTIME 0xebadf00d #endif +#endif // Sleep for the given number of nanoseconds, a bad way to handle contention. void NanoSleep(uint64_t ns); -- cgit v1.2.3