Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix first visible timestamp and LCPV #37144

Merged
merged 2 commits into from
Dec 7, 2021
Merged

Commits on Dec 7, 2021

  1. Fix first visible timestamp

    In ampproject#36273, I switched from `Date.now()` to `performance.now()`, thinking it was a higher resolution timestamp time since the unix epoch. But, `peformance.now` is relative to _page load time_ (or `timeOrigin`), not the epoch.
    
    This matters because our "since visible" metrics use the epoch as their base time, meaning the timestamps are roughly 1.6 trillion milliseconds. But `performance.now` is tiny, in the range of a few million for a page that was loaded an hour ago. When we calculated the "since visible", we received values that were still in the trillions when we expect millions.
    
    By adding `performance.now()` and `performance.timeOrigin`, we get a timestamp relative to the epoch. Now when we calculate the "since visible", we get the correct values.
    jridgewell committed Dec 7, 2021
    Configuration menu
    Copy the full SHA
    d0760e2 View commit details
    Browse the repository at this point in the history
  2. Update tests

    jridgewell committed Dec 7, 2021
    Configuration menu
    Copy the full SHA
    7dac436 View commit details
    Browse the repository at this point in the history