diff --git a/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.mm b/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.mm index ae811e14cb0..26b4e21ed72 100644 --- a/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.mm +++ b/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.mm @@ -8,6 +8,7 @@ #include "RCTJSIExecutorRuntimeInstaller.h" #import +#include namespace facebook { namespace react { @@ -21,8 +22,8 @@ JSIExecutor::RuntimeInstaller RCTJSIExecutorRuntimeInstaller(JSIExecutor::Runtim bindNativeLogger(runtime, iosLoggingBinder); PerformanceNow iosPerformanceNowBinder = []() { - // CACurrentMediaTime() returns the current absolute time, in seconds - return CACurrentMediaTime() * 1000; + auto time = std::chrono::system_clock::now().time_since_epoch(); + return std::chrono::duration_cast(time).count(); }; bindNativePerformanceNow(runtime, iosPerformanceNowBinder); diff --git a/ReactAndroid/src/main/jni/react/jni/NativeTime.cpp b/ReactAndroid/src/main/jni/react/jni/NativeTime.cpp index 05eb72b49bc..f0ed4ced09b 100644 --- a/ReactAndroid/src/main/jni/react/jni/NativeTime.cpp +++ b/ReactAndroid/src/main/jni/react/jni/NativeTime.cpp @@ -12,14 +12,8 @@ namespace facebook { namespace react { double reactAndroidNativePerformanceNowHook() { - auto time = std::chrono::steady_clock::now(); - auto duration = std::chrono::duration_cast( - time.time_since_epoch()) - .count(); - - constexpr double NANOSECONDS_IN_MILLISECOND = 1000000.0; - - return duration / NANOSECONDS_IN_MILLISECOND; + auto time = std::chrono::system_clock::now().time_since_epoch(); + return std::chrono::duration_cast(time).count(); } } // namespace react