summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dan Willemsen <dwillemsen@google.com> 2016-10-26 10:13:15 -0700
committer Dan Willemsen <dwillemsen@google.com> 2016-10-26 10:13:15 -0700
commit0fc1c9a34d169cfe46b91ecef044908a2011a494 (patch)
tree7aadb40a2f5851ff64d492786e0ab094aad2982c
parentf877c165de3868a28fcfeb36e742efb02f39b854 (diff)
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
-rw-r--r--runtime/base/time_utils.h4
1 files changed, 3 insertions, 1 deletions
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);