Skip to content

Tick events should use performance.now() over Date.now() #16042

@mattpk

Description

@mattpk

What's the issue?

AMP runtime should use performance.now() instead of Date.now() when recording timestamps for tick events. Clock changes such as those triggered by software like NTP, crossing daylight savings boundaries, crossing leap days / seconds, etc all can affect Date.now making it unreliable for precision timing.

I realize that the viewer's performance clock and the runtime's performance clock can be different. Maybe returning performance.now() + performance.timing.navigationStart would maintain the same interface but has the monotonic property that Date.now() lacks.

What browsers are affected?

All browsers

Which AMP version is affected?

All AMP versions afaik

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions