File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
ReactAndroid/src/main/jni/react/jni Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 2222 bindNativeLogger (runtime, iosLoggingBinder);
2323
2424 PerformanceNow iosPerformanceNowBinder = []() {
25- auto time = std::chrono::system_clock::now ().time_since_epoch ();
26- return std::chrono::duration_cast<std::chrono::milliseconds>(time).count ();
25+ auto time = std::chrono::steady_clock::now ();
26+ auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(
27+ time.time_since_epoch ())
28+ .count ();
29+
30+ constexpr double NANOSECONDS_IN_MILLISECOND = 1000000.0 ;
31+
32+ return duration / NANOSECONDS_IN_MILLISECOND;
2733 };
2834 bindNativePerformanceNow (runtime, iosPerformanceNowBinder);
2935
Original file line number Diff line number Diff line change @@ -12,8 +12,14 @@ namespace facebook {
1212namespace react {
1313
1414double reactAndroidNativePerformanceNowHook () {
15- auto time = std::chrono::system_clock::now ().time_since_epoch ();
16- return std::chrono::duration_cast<std::chrono::milliseconds>(time).count ();
15+ auto time = std::chrono::steady_clock::now ();
16+ auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(
17+ time.time_since_epoch ())
18+ .count ();
19+
20+ constexpr double NANOSECONDS_IN_MILLISECOND = 1000000.0 ;
21+
22+ return duration / NANOSECONDS_IN_MILLISECOND;
1723}
1824
1925} // namespace react
You can’t perform that action at this time.
0 commit comments