Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Safari (Mac OS X Lion) returns wrong epochtime value to position.timestamp call

I am creating a website that uses W3C Geolocation API and position.timestamp for timestamp. I have tested it on Safari 5.1.6 (Mac OS X Lion) and iPhone (5.x). iPhone default browser returns correct value for timestamp, while Safari does not. Has anyone experience similar issue? Is there a bug in Safari?

Test it here: http://jsfiddle.net/vRRdE/2/

Running the test above (thanks Tyilo) I get 360419807893 (wrong one using position.timestamp) and 1338727007910 (correct one using Date().getTime()) using Safari on Mac OS X.

like image 607
Radim Avatar asked Jun 03 '12 12:06

Radim


1 Answers

It seems that desktop Safari uses January 1, 2001 as the default epoch so the best approach here is probably just using Date().getTime();

like image 182
Thomas Denney Avatar answered Nov 18 '22 21:11

Thomas Denney