From 4a2410fae65afb85e1fec6d922005054b05de59f Mon Sep 17 00:00:00 2001 From: Romuald CARI Date: Mon, 22 Aug 2022 21:51:24 -0700 Subject: [PATCH] Fix detection of clock_gettime availability (#1724) Summary: On Apple platforms, following the SDK development [1] guidelines, we can check for the availability (as in definition) of symbols using macros. This is more reliable notably when targeting iOS platforms or simulators where the previous approach used to create redefinition problems [2] & [3]. [1] https://developer.apple.com/forums/thread/67102 [2] https://github.com/facebook/folly/issues/1470 [3] https://github.com/facebook/flipper/issues/834 Pull Request resolved: https://github.com/facebook/folly/pull/1724 Reviewed By: Gownta Differential Revision: D38406371 Pulled By: Orvid fbshipit-source-id: c5e37d3cd7d8764049953ffba6c6a449217c8cb1 --- folly/portability/Time.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/folly/portability/Time.h b/folly/portability/Time.h index 264fbac4a8a..f51ff105b56 100644 --- a/folly/portability/Time.h +++ b/folly/portability/Time.h @@ -27,11 +27,7 @@ // solve that by pretending we have it here in the header and // then enable our implementation on the source side so that // gets linked in instead. -#if defined(__MACH__) && \ - ((!defined(TARGET_OS_OSX) || TARGET_OS_OSX) && \ - (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12)) || \ - (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE != 0 && \ - (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_10_0)) +#if defined(__MACH__) && defined(__CLOCK_AVAILABILITY) #ifdef FOLLY_HAVE_CLOCK_GETTIME #undef FOLLY_HAVE_CLOCK_GETTIME