Open steph643 opened 9 years ago
TimeSync uses a setInterval
to check if there are unexpected differences in time each tick, such as the user waking their computer up from sleep, changing system time, etc.
https://github.com/mizzao/meteor-timesync/blob/master/timesync-client.js#L23
CPU busyness causes a setInterval
to fire after longer than expected, which makes it look like there was an unexpected time change. I'm not sure if there is an easy way around this, but I'm all ears if you have suggestions.
If you don't like the log messages, you can set TimeSync.loggingEnabled = false
, but there's no way to prevent re-syncing at the moment.
Thanks for pointing me to loggingEnabled
.
Hi Andrew. Where do you think is the best place to put the TimeSync.loggingEnabled = false
statement? Anywhere, or client Meteor.startup()
?
It only logs on the client, but you can put it anywhere in a client folder, preferably in lib
so it runs immediately. No Meteor.startup()
needed.
// client/init.js
Meteor.startup(function () {
TimeSync.loggingEnabled = false;
});
Error: ReferenceError: Can't find variable: TimeSync
meteor add mizzao:timesync
to make it explicitly available in the top level of your app.
but there's no way to prevent re-syncing at the moment.
Any updates on this? I'm using it for that chat part of my app, and just want to use the server time once (in my add-chat stub, to prevent jumping of chatlines). And I'm just afraid that this will put extra strain on my server, no?
No I don't think it materially puts extra strain on your server.
Each time my app uses the CPU intensively for a few seconds, I get the following message in the console:
This brings me two questions:
TimeSync.watchClockChanges
was false by default, preventing re-sync to occur. I tried to force it to false anyway, but it has no effect. How can I prevent re-sync?