Fix up and namespace clock_gettime and clock_getres for MacOS
[folly.git] / folly / portability / Time.cpp
index 54b3d0a10f0ac9d93045fea4494483f0a19f5261..e54286fe30893400cd6e40b36c5d0e8481795147 100644 (file)
@@ -43,6 +43,10 @@ static void duration_to_ts(
 #include <mach/thread_act.h>
 #include <mach/vm_map.h>
 
+namespace folly {
+namespace portability {
+namespace time {
+
 static std::chrono::nanoseconds time_value_to_ns(time_value_t t) {
   return std::chrono::seconds(t.seconds) +
       std::chrono::microseconds(t.microseconds);
@@ -136,6 +140,10 @@ int clock_getres(clockid_t clk_id, struct timespec* ts) {
 
   return 0;
 }
+
+} // namespace time
+} // namespace portability
+} // namespace folly
 #elif defined(_WIN32)
 #include <errno.h>
 #include <locale.h>
@@ -144,6 +152,10 @@ int clock_getres(clockid_t clk_id, struct timespec* ts) {
 
 #include <folly/portability/Windows.h>
 
+namespace folly {
+namespace portability {
+namespace time {
+
 using unsigned_nanos = std::chrono::duration<uint64_t, std::nano>;
 
 static unsigned_nanos filetimeToUnsignedNanos(FILETIME ft) {
@@ -272,6 +284,10 @@ extern "C" int clock_gettime(clockid_t clock_id, struct timespec* tp) {
       return -1;
   }
 }
+
+} // namespace time
+} // namespace portability
+} // namespace folly
 #else
 #error No clock_gettime(3) compatibility wrapper available for this platform.
 #endif