From f04cf0cd86456b9a11bc545a231fff56693a6124 Mon Sep 17 00:00:00 2001 From: Michael Lee Date: Mon, 13 Jun 2016 17:05:24 -0700 Subject: [PATCH] Time.h portability for iOS 10. Summary: The iOS sdk adds `clock_gettime` support. Reviewed By: clementgenzmer Differential Revision: D3427621 fbshipit-source-id: fcd3022c5ea05ceb8e289fbeb1ae845155d2dea9 --- folly/portability/Time.cpp | 2 +- folly/portability/Time.h | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/folly/portability/Time.cpp b/folly/portability/Time.cpp index a9160356..ea6d4ef0 100755 --- a/folly/portability/Time.cpp +++ b/folly/portability/Time.cpp @@ -17,7 +17,7 @@ #include #if !FOLLY_HAVE_CLOCK_GETTIME -#if __MACH__ +#if __MACH__ && !defined(__CLOCK_AVAILABILITY) #include #include diff --git a/folly/portability/Time.h b/folly/portability/Time.h index 642a95de..b3dfa688 100755 --- a/folly/portability/Time.h +++ b/folly/portability/Time.h @@ -21,9 +21,11 @@ #include -// These aren't generic implementations, so we can only declare them on -// platforms we support. -#if !FOLLY_HAVE_CLOCK_GETTIME && (defined(__MACH__) || defined(_WIN32)) +// These aren't generic implementations, so we can only declare them +// on platforms we support. Apple started defining clock_gettime in +// iOS 10 / OSX 12 and is gated via __CLOCK_AVAILABILITY. +#if !FOLLY_HAVE_CLOCK_GETTIME && \ + (defined(_WIN32) || (defined(__MACH__) && !defined(__CLOCK_AVAILABILITY))) #define CLOCK_REALTIME 0 // The Windows implementation supports a few other // clock types as well. -- 2.34.1