Meteor-Community-Packages / meteor-timesync

NTP-style time synchronization between server and client, and facilities to use server time reactively in Meteor applications.
https://packosphere.com/mizzao/timesync
MIT License
118 stars 36 forks source link

TimeServer not syncing in Firefox. #28

Closed faysal515 closed 9 years ago

faysal515 commented 9 years ago
TimeSync.resync();

            if(TimeSync.isSynced()){
                console.log("current Time from if >>> "+ TimeSync.serverTime()/1000);
            }

The above is my client-side code . Chrome console works fine. But Firefox does nothing instead of re syncing it forcefully.

mizzao commented 9 years ago

Resync happens automatically as the app is loading, and it is not synchronous. There is no need to call it.

It seems like your isSynced is just getting called before the initial sync happens. Can you try this code path somewhere after the initial load (i.e. wait 10 seconds)?

faysal515 commented 9 years ago

sorry for the delayed response. fixed the issue by syncing the time in Meteor.startup

mizzao commented 9 years ago

@faysal515 there should be no need for you to call TimeSync.resync() at all in most cases. It is called upon startup automatically.

faysal515 commented 9 years ago

thank you for the response. but Firefox threw me sometimes not a number error, thus had to make this up.