NodeGuy / server-date

Make the server's clock available in the browser.
http://www.nodeguy.com/serverdate/
Mozilla Public License 2.0
193 stars 53 forks source link

not accurate at all #24

Closed greg606 closed 9 years ago

greg606 commented 9 years ago

i need to sync clients. but your functions shows two different times (1s diff) in two browsers (on one computer) unless i do something wrong and then maybe you could correct me. i have seconds based sessions and 1s difference is huge. I would be grateful for any advice how to make timers accurate (each start at the same server time )

Game.toFullSecond = 1000 - ServerDate.getMilliseconds();
        setTimeout(function () {
            timer = new CountDownTimer(seconds);
        }, Game.toFullSecond);
NodeGuy commented 9 years ago

Try looking at the messages in the JavaScript console of each browser for more information about what's going on.