Fix first visible timestamp and LCPV #37144
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #36273, I switched from
Date.now()
toperformance.now()
, thinking it was a higher resolution timestamp time since the unix epoch. But,performance.now
is relative to page load time (orperformance.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()
andperformance.timeOrigin
, we get a timestamp relative to the epoch. Now when we calculate the "since visible", we get the correct values.Fixes #37072.