diff --git a/tensorflow/core/platform/posix/env_time.cc b/tensorflow/core/platform/posix/env_time.cc
index 59a67b17aa..568f7158e0 100644
--- a/tensorflow/core/platform/posix/env_time.cc
+++ b/tensorflow/core/platform/posix/env_time.cc
@@ -18,6 +18,9 @@ limitations under the License.
 
 #include "tensorflow/core/platform/env_time.h"
 
+#include <mach/clock.h>
+#include <mach/mach.h>
+
 namespace tensorflow {
 
 namespace {
@@ -28,7 +31,14 @@ class PosixEnvTime : public EnvTime {
 
   uint64 NowNanos() override {
     struct timespec ts;
-    clock_gettime(CLOCK_REALTIME, &ts);
+    //clock_gettime(CLOCK_REALTIME, &ts);
+    clock_serv_t cclock;
+    mach_timespec_t mts;
+    host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
+    clock_get_time(cclock, &mts);
+    mach_port_deallocate(mach_task_self(), cclock);
+    ts.tv_sec = mts.tv_sec;
+    ts.tv_nsec = mts.tv_nsec;
     return (static_cast<uint64>(ts.tv_sec) * kSecondsToNanos +
             static_cast<uint64>(ts.tv_nsec));
   }
