Skip to content

Fix Performance time origin on Apple platforms - #60473

Merged
meta-codesync[bot] merged 1 commit into
react:mainfrom
rubennorte:export-D135623722
Dec 2, 2026
Merged

meta-codesync[bot] merged 1 commit into
react:mainfrom
rubennorte:export-D135623722

Conversation

@rubennorte

Copy link
Copy Markdown
Member

Summary:
performance.now() excludes device sleep on Apple platforms, but the epoch offset was sampled from a clock that includes it. That made performance.timeOrigin + performance.now() lag wall time by sleep accumulated before the offset was initialized. Compute the offset from the same platform clock as performance.now() without changing the boot-relative timestamp contract. Run the existing epoch-mapping test on macOS as well.

Fixes #60450: sleep before the origin is initialized no longer skews the sum. Sleep after initialization is still excluded.

Changelog:
[iOS][Fixed] - Use a consistent clock for performance.timeOrigin and performance.now() on Apple platforms

Differential Revision: D135623722

Summary:
`performance.now()` excludes device sleep on Apple platforms, but the epoch offset was sampled from a clock that includes it. That made `performance.timeOrigin + performance.now()` lag wall time by sleep accumulated before the offset was initialized. Compute the offset from the same platform clock as `performance.now()` without changing the boot-relative timestamp contract. Run the existing epoch-mapping test on macOS as well.

Fixes react#60450: sleep before the origin is initialized no longer skews the sum. Sleep after initialization is still excluded.

Changelog:
[iOS][Fixed] - Use a consistent clock for `performance.timeOrigin` and `performance.now()` on Apple platforms

Differential Revision: D135623722
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 2, 2026
@facebook-github-tools facebook-github-tools Bot added p: Facebook Partner: Facebook Partner labels Dec 2, 2026
@meta-codesync

meta-codesync Bot commented Dec 2, 2026

Copy link
Copy Markdown

@rubennorte has exported this pull request. If you are a Meta employee, you can view the originating Diff in D135623722.

@christophpurrer christophpurrer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

@meta-codesync
meta-codesync Bot merged commit 5bb45eb into react:main Dec 2, 2026
278 of 289 checks passed
@react-native-bot react-native-bot added the Merged This PR has been merged. label Dec 2, 2026
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @rubennorte in 5bb45eb

When will my fix make it into a release? | How to file a pick request?

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

3 participants