Closed ilikejames closed 10 years ago
When there is clock difference between the client server, the offset is wrong.
This can be tested by changing the lib/ntp.js ntp:server_sync to:
socket.emit('ntp:server_sync', { t1 : Date.now() + 8000 /* clock 8 seconds a head from client */, t0 : data.t0 });
The proposed change is to update the client js file so that the diff is calculated by:
var diff = Date.now() - data.t1 + ((Date.now() - data.t0)/2);
When there is clock difference between the client server, the offset is wrong.
This can be tested by changing the lib/ntp.js ntp:server_sync to:
The proposed change is to update the client js file so that the diff is calculated by:
var diff = Date.now() - data.t1 + ((Date.now() - data.t0)/2);