performance.timeOrigin returning a date in the past

Viewed 27

I've noticed while debugging that I was seeing some really incorrect values when attempting to calculate TTFB on our website, and realized that in certain browser tabs I'm getting incorrect values for performance.timeOrigin.

Some sample output from the devtools console:

new Date()
> Mon Sep 19 2022 13:56:37 GMT-0500 (Central Daylight Time)
new Date(performance.timing.responseStart)
> Mon Sep 19 2022 13:56:14 GMT-0500 (Central Daylight Time)
new Date(performance.timeOrigin)
> Fri Sep 16 2022 21:39:16 GMT-0500 (Central Daylight Time)

You'll notice that the first two values are correct, while the last is almost 3 days in the past. This incorrect behavior survives reloading the tab, and even opening a new tab, and going to the same domain.

Reloading the tab and checking performance.timeOrigin will show that it continues to move forward in time like normal... but still almost 3 days in the past.

Interesting experimental results:

  1. Initial tab opened is example.com/a and shows bad performance.timeOrigin
  2. Opening a brand new tab, go to example.com/b and performance.timeOrigin will still be bad.
  3. I can then type in a new url like google.com and performance.timeOrigin is correct.
  4. Then typing in example.com/c and performance.timeOrigin is bad again.

I'm thinking it may have something to do with hibernating/sleeping the computer, and any domains which were opened in Chrome at that time have their timeOrigin screwed up, but not completely sure.

Closing chrome and reopening seems to have fixed the problem, but I'm wondering if anybody know what exactly caused this?

0 Answers
Related