Skip to content

[DO NOT MERGE] Reproducer for #60450: performance.timeOrigin + now() lags Date.now() by sleep on iOS - #60451

Draft
will-selfactualize wants to merge 1 commit into
react:mainfrom
will-selfactualize:repro-60450-timeorigin-sleep
Draft

will-selfactualize wants to merge 1 commit into
react:mainfrom
will-selfactualize:repro-60450-timeorigin-sleep

Conversation

@will-selfactualize

Copy link
Copy Markdown

Reproducer only, not for merging. This is the reproducer requested for #60450.

Summary:

On iOS and macOS, performance.timeOrigin + performance.now() lags Date.now() by the device's total sleep time since boot. Since #55977 (first released in 0.86.0), now() uses mach_absolute_time(), which stops during sleep. timeOrigin is still computed against std::chrono::steady_clock (mach_continuous_time()), which keeps counting during sleep. Root cause and suggested fix are in #60450.

This PR changes only RNTesterPlayground.js, so that it displays Date.now() - (performance.timeOrigin + performance.now()) once a second.

Changelog:

[INTERNAL] - Playground reproducer for #60450

Test Plan:

  1. Run RNTester on an iOS simulator or on a device, and open Playground.
  2. It shows about 0 s on a freshly booted device. After the host Mac or the device sleeps (for example, put the Mac to sleep for a minute with the screen open), the value jumps by the length of the sleep and stays there.
  3. Expected: about 0 s throughout, as on Android, and as on iOS before 0.86.

The same drift on a 0.86.3 Mac Catalyst app was 2178.79 s. On that machine, mach_continuous_time() - mach_absolute_time() was 2178.8 s at the same moment.

🤖 Generated with Claude Code

…ep on iOS

Shows Date.now() - (performance.timeOrigin + performance.now()) in the
Playground, refreshed every second. On iOS/macOS it jumps by the sleep
duration after the device or host Mac sleeps; it should stay ~0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@meta-cla

meta-cla Bot commented Dec 2, 2026

Copy link
Copy Markdown

Hi @will-selfactualize!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant