Revert D5312574: [folly] Fix up and namespace clock_gettime and clock_getres for...
[folly.git] / folly / portability / Time.h
index a7e5cf2da932e1d30904b34d5c536bdc5d35727a..eb6c7941c19eabbeedcf2b0c5764707821da4549 100644 (file)
@@ -20,7 +20,6 @@
 #include <time.h>
 
 #include <folly/portability/Config.h>
-#include <folly/Portability.h>
 
 // OSX is a pain. The XCode 8 SDK always declares clock_gettime
 // even if the target OS version doesn't support it, so you get
 // 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 __MACH__ && FOLLY_HAVE_CLOCK_GETTIME &&                    \
+#if __MACH__ &&                                                \
     (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12 || \
      __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0)
 
+#ifdef FOLLY_HAVE_CLOCK_GETTIME
+#undef FOLLY_HAVE_CLOCK_GETTIME
+#endif
+
+#define FOLLY_HAVE_CLOCK_GETTIME 1
 #define FOLLY_FORCE_CLOCK_GETTIME_DEFINITION 1
 
 #endif
 #define CLOCK_MONOTONIC 1
 #define CLOCK_PROCESS_CPUTIME_ID 2
 #define CLOCK_THREAD_CPUTIME_ID 3
-#endif
 
-#if (!FOLLY_HAVE_CLOCK_GETTIME || FOLLY_FORCE_CLOCK_GETTIME_DEFINITION) && (defined(__MACH__) || defined(_WIN32))
-namespace folly {
-namespace portability {
-namespace time {
 typedef uint8_t clockid_t;
-int clock_gettime(clockid_t clk_id, struct timespec* ts);
-int clock_getres(clockid_t clk_id, struct timespec* ts);
-}
-}
-}
-
-FOLLY_PUSH_WARNING
-#if __CLANG_PREREQ(3, 0)
-FOLLY_GCC_DISABLE_WARNING("-Wheader-hygiene")
-#endif
-/* using override */ using namespace folly::portability::time;
-FOLLY_POP_WARNING
+extern "C" int clock_gettime(clockid_t clk_id, struct timespec* ts);
+extern "C" int clock_getres(clockid_t clk_id, struct timespec* ts);
 #endif
 
 #ifdef _WIN32