Reputation: 4898
I notice that when I click one element on my site e.timeStamp is reported by Firebug in the event handler as a 9-digit number, like 866523917, and when I click a different element e.timeStamp is reported in that handler by Firebug as a 16-digit number, like 1376344365954000. Why the difference?
Thanks
Upvotes: 5
Views: 3504
Reputation: 35225
As defined in standard timeStamp
returns number of milliseconds since epoch:
Used to specify the time (in milliseconds relative to the epoch) at which the event was created. Due to the fact that some systems may not provide this information the value of timeStamp may be not available for all events. When not available, a value of 0 will be returned.
However, there is no strict definition for epoch:
Examples of epoch time are the time of the system start or 0:0:0 UTC 1st January 1970.
Some events are using first variant (system start) while others use time since 1970. Hence the difference. As a side note it's possible that timeStamp
is not provided at all for some events, then its value will be 0
.
Upvotes: 5
Reputation: 4898
I think the problem is Firefox. I get the larger number (13 digits plus 3 zeroes) on Safari and Chrome, I came across some articles that say Firefox has a bug: http://bugs.jquery.com/ticket/10755. One article suggested it might be reporting the time since the last reboot.
I still don't understand why Firefox would report it one way for one interrupt and another way for another interrupt. For my purposes I'll just use timestamp=Date.now() instead of e.timestamp. That seems to be consistent at any interrupt.
Upvotes: 0