Skip to content

fix(clock): reset ticks on first install to avoid realTime drift#40198

Merged
dgozman merged 1 commit intomicrosoft:mainfrom
dgozman:fix-clock-install-ticks-drift
Apr 14, 2026
Merged

fix(clock): reset ticks on first install to avoid realTime drift#40198
dgozman merged 1 commit intomicrosoft:mainfrom
dgozman:fix-clock-install-ticks-drift

Conversation

@dgozman
Copy link
Copy Markdown
Collaborator

@dgozman dgozman commented Apr 14, 2026

Summary

  • Between inject() (which starts the realTime ticker) and the user's install(time) call, _now.ticks accumulates drift. Since performance.now() returns ticks, that drift leaked into values the page observed.
  • Reset ticks to 0 on the first install() (when origin hasn't been set yet) so the monotonic counter starts from a pristine state.
  • Exposed by flaky library/page-clock.spec.ts:282 replaces global performance.timeOrigin on Firefox.

Between `inject()` (which starts the realTime ticker) and the user's
`install(time)` call, `_now.ticks` accumulates drift. Since
`performance.now()` returns `ticks`, this drift leaked into
`performance.now()` values observed by the page.

Reset `ticks` to 0 on the first `install()` (when origin has not been
set yet) so the monotonic counter starts from a pristine state.

Exposed by the flaky test
`library/page-clock.spec.ts:282 replaces global performance.timeOrigin`
on Firefox.
@github-actions
Copy link
Copy Markdown
Contributor

Test results for "tests 1"

1 failed
❌ [playwright-test] › ui-mode-test-network-tab.spec.ts:459 › should not preserve selection across test runs @macos-latest-node20

3 flaky ⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1080 › cli codegen › should not throw csp directive violation errors `@firefox-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:267 › should show screenshot `@macos-latest-node20`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:465 › should filter actions tab on double-click `@windows-latest-node20`

39179 passed, 847 skipped


Merge workflow run.

@github-actions
Copy link
Copy Markdown
Contributor

Test results for "MCP"

5974 passed, 916 skipped


Merge workflow run.

@dgozman dgozman merged commit 2e4822e into microsoft:main Apr 14, 2026
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants