Reputation: 1331
I have the following code
$("p").on( "mousemove", function(event) {
$("p").text(event.timeStamp);
});
It returns a 9 digit positive value in both Firefox and Edge but in Chrome only a six digit decimal number. My chrome version is 43. What is wrong here?
EDIT : I updated my Chrome version but I still get either negative time values or a six digit number. My Chrome version is 48 now. I am using Window 10 64 bit if that matters.
EDIT 2 : When I reload my page, for a brief period of time the value is positive. After that it becomes negative. The negative value decreases with time and finally, it becomes positive and keeps increasing.
Upvotes: 8
Views: 965
Reputation: 2391
It looks to me like event.timeStamp
is now milliseconds since page load rather than milliseconds since January 1st 1970 00:00:00 (as defined in the specification).
I check this by comparing event.timeStamp
to performance.now()
which are the same.
Upvotes: 2
Reputation: 125
In chrome (version 48/49... m) the event.timeStamp return a float value, something like 18000.123..
I have simply stopped using event.timeStamp and instead I have put Date.now(), which is not as precise but avoid this issue.
Upvotes: 2