php - Countdown timer changed with local time -


i have game site, in need display timer until match time. once timer reaches limit, need load games.

for this, have used jquery countdown. working fine in general.

my problem is, while timer running if user changes system time(local time), remaining time limit changed , game started.

how prevent countdown timer local time? please me fix problem.

my code,

$('#gamewindow').countdown({         until   : 100,         layout:'{mn} : {s<}{snn} {s>}',         onexpiry: function () {                  $('#gamewindow').load('game.php');                  },     });  });   <div id="gamewindow"></div> 

instead of initializing timer via plain javascript (which return client-time, i.e., time on client's computer), should instead rely on server-time, i.e., time on server. standardize timing players.

so, upon visiting countdown page, javascript counter initialized server's time. use ajax or hack-y php this. task, start-up time js needs server; afterwards, "countdown" effect managed js. of course, not uber-synced error pretty forgivable. if user refreshes different local timezone setting, js re-initialize server time--no problems!


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -