SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

Use mach_absolute_time for HighResTimeStamp on Apple platforms (#55977)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55977

Changelog: [internal]

On iOS/macOS, `std::chrono::steady_clock` uses `mach_continuous_time()` which includes device sleep time. This causes compatibility issues with iOS system APIs like `UITouch.timestamp` and `NSProcessInfo.processInfo.systemUptime` which use `mach_absolute_time()` (excludes sleep time).

This diff modifies `HighResTimeStamp` to use `mach_absolute_time()` directly on Apple platforms, ensuring timestamps are compatible with iOS system APIs and native performance logging systems.

Changes:
- Added `mach_absolute_time()` based clock for Apple platforms in `primitives.h`
- Simplified `RCTHighResTimeStampFromSeconds()` since iOS timestamps now share the same clock domain
- Updated documentation to explain platform-specific clock behavior

Reviewed By: hoxyq

Differential Revision: D95554947

fbshipit-source-id: 322331867b9ed36260bb8f35b8bbca2f4937a0ed
R
Rubén Norte committed
6aa99ad8626a99f6abe8cbb63acae1ea39f83ac8
Parent: 41a1941
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com> on 3/9/2026, 6:52:46 PM