diff --git a/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.mm b/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.mm index f5c82368f31920..da0f919a3f86af 100644 --- a/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.mm +++ b/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.mm @@ -22,8 +22,14 @@ bindNativeLogger(runtime, iosLoggingBinder); PerformanceNow iosPerformanceNowBinder = []() { - auto time = std::chrono::system_clock::now().time_since_epoch(); - return std::chrono::duration_cast(time).count(); + 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; }; bindNativePerformanceNow(runtime, iosPerformanceNowBinder); diff --git a/ReactAndroid/src/main/jni/react/jni/NativeTime.cpp b/ReactAndroid/src/main/jni/react/jni/NativeTime.cpp index a338db11ee36a6..042805ff66da38 100644 --- a/ReactAndroid/src/main/jni/react/jni/NativeTime.cpp +++ b/ReactAndroid/src/main/jni/react/jni/NativeTime.cpp @@ -12,8 +12,14 @@ namespace facebook { namespace react { double reactAndroidNativePerformanceNowHook() { - auto time = std::chrono::system_clock::now().time_since_epoch(); - return std::chrono::duration_cast(time).count(); + 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; } } // namespace react