Reputation: 101
I am almost certain my previous function worked like a charm before but fails now. Maybe someone can help me? I have the following sample HTML code:
<span id="timetest" data-starttime="<?php echo time(); ?>"><?php echo time(); ?></span>
And then in Jquery I try to get the difference between the time() and the date.now() / 1000 (because of milliseconds) like this:
var startttime = $('#timetest').data('starttime');
var submitttime = Math.floor(Date.now() / 1000);
var totalttime = submitttime - startttime;
But whatever I do the outcome of totaltime = -66 (seconds) ish. What has changed, or what am I doing wrong? Anyone else noticed this issue?
Upvotes: 2
Views: 119
Reputation: 101
Like CBroe said above: "Not every computer system in the world necessarily has its clock set absolutely correct … If server and client are different machines, there can easily be differences"
Upvotes: 2