Event.timeStamp and Date.now() don't return the same timestamp format

RESOLVED INACTIVE

Status

()

Core
DOM: Events
RESOLVED INACTIVE
3 years ago
3 days ago

People

(Reporter: Daniel Baulig, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36

Steps to reproduce:

http://jsfiddle.net/L1zp9L2h/1/


Actual results:

See output in console: Event.timeStamp has more digits than Date.now(). 


Expected results:

According to the MDN reference, they should both return the milliseconds since the unix epoch (see https://developer.mozilla.org/en-US/docs/Web/API/Event/timeStamp and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now)

Tested as working in Safari and Chrome.
What Firefox version are you testing? Event.timeStamp returns a DOMHighResTimeStamp on Firefox Nightly and Developer Edition. See https://developer.mozilla.org/en-US/Firefox/Releases/33/Site_Compatibility#event.timeStamp_now_returns_DOMHighResTimeStamp_on_Nightly.2FAurora_for_Windows and Bug 1026804.
Component: Untriaged → DOM: Events
Product: Firefox → Core
This doesn't return a DOMHighResTimeStamp on Firefox Nightly for OS X:

> window.addEventListener('click', event => console.log(event.timeStamp));

So only specific events, probably video/audio-related, are returning a DOMHighResTimeStamp?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Version: 39 Branch → Trunk
(Reporter)

Comment 3

3 years ago
As specified in the task this was on Firefox 39. Note that I was using a video related event in the fiddle. event.timeStamp.constructor.name returned "Number" (just as Date.now()). Even if a DOMHighResTimeStamp was returned, from my understanding the pre-fraction digits should be the same, the millisecond fractions should be reflected by digits after the decimal point (which is not the case here if you inspect the console output of the fiddle more closely).
Our current Event.timeStamp implementation is a mess. We use different time scales for different events.

Currently we're trying to switch everything over to DOMHighResTimeStamp but it's taking time to convert the native timestamps over correctly (bug 1026803). I'm going to get that moving again this quarter.

I think we only have the DOMHighResTimeStamp path switched on for Windows on Nightly/Aurora (aka Developer Edition).

Comment 5

3 days ago
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Last Resolved: 3 days ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.