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

large variation in offset #40

Closed trelive closed 3 years ago

trelive commented 4 years ago

Hi, I'm hoping someone can explain why there seems to be a large variation in the offset from a set of ServerDate samples. Looking at the sample set below, the precision is mostly within 10ms, however, the offset between the server time and system clock varies considerably. I got a similar variation retrieving the server time with a PHP script. Is there an explanation for this or am I just missing something? Many thanks.

[ServerDate] sample: 1, offset: 14.5 +/- 37.5 ms [ServerDate] sample: 2, offset: -34 +/- 10 ms [ServerDate] sample: 3, offset: -52 +/- 8 ms [ServerDate] sample: 4, offset: -68 +/- 8 ms [ServerDate] sample: 5, offset: -84.5 +/- 7.5 ms [ServerDate] sample: 6, offset: -100 +/- 8 ms [ServerDate] sample: 7, offset: -116.5 +/- 8.5 ms [ServerDate] sample: 8, offset: -133.5 +/- 8.5 ms [ServerDate] sample: 9, offset: -150.5 +/- 8.5 ms [ServerDate] sample: 10, offset: -167.5 +/- 8.5 ms [ServerDate] sample: 11, offset: -186 +/- 9 ms [ServerDate] sample: 12, offset: -204.5 +/- 9.5 ms [ServerDate] sample: 13, offset: -224.5 +/- 9.5 ms [ServerDate] sample: 14, offset: -243.5 +/- 9.5 ms [ServerDate] sample: 15, offset: -262.5 +/- 9.5 ms [ServerDate] sample: 16, offset: -281.5 +/- 9.5 ms [ServerDate] sample: 17, offset: -300.5 +/- 9.5 ms [ServerDate] sample: 18, offset: -319 +/- 9 ms [ServerDate] sample: 19, offset: -337.5 +/- 9.5 ms [ServerDate] sample: 20, offset: -356.5 +/- 9.5 ms [ServerDate] sample: 21, offset: -377 +/- 11 ms [ServerDate] sample: 22, offset: -398 +/- 10 ms [ServerDate] sample: 23, offset: -417.5 +/- 9.5 ms [ServerDate] sample: 24, offset: -436.5 +/- 9.5 ms [ServerDate] sample: 25, offset: -456 +/- 10 ms [ServerDate] sample: 26, offset: -476.5 +/- 9.5 ms [ServerDate] sample: 27, offset: -494 +/- 8 ms [ServerDate] sample: 28, offset: -513.5 +/- 10.5 ms [ServerDate] sample: 29, offset: -533.5 +/- 9.5 ms [ServerDate] sample: 30, offset: -553 +/- 10 ms [ServerDate] sample: 31, offset: -572 +/- 9 ms [ServerDate] sample: 32, offset: -591 +/- 9 ms [ServerDate] sample: 33, offset: -609 +/- 9 ms [ServerDate] sample: 34, offset: -630 +/- 11 ms [ServerDate] sample: 35, offset: -650 +/- 9 ms [ServerDate] sample: 36, offset: -668.5 +/- 9.5 ms [ServerDate] sample: 37, offset: -687 +/- 9 ms [ServerDate] sample: 38, offset: 294 +/- 10 ms [ServerDate] sample: 39, offset: 274.5 +/- 9.5 ms [ServerDate] sample: 40, offset: 255 +/- 10 ms [ServerDate] sample: 41, offset: 236 +/- 9 ms [ServerDate] sample: 42, offset: 218 +/- 9 ms [ServerDate] sample: 43, offset: 200 +/- 9 ms [ServerDate] sample: 44, offset: 181.5 +/- 9.5 ms [ServerDate] sample: 45, offset: 162 +/- 10 ms [ServerDate] sample: 46, offset: 143 +/- 9 ms [ServerDate] sample: 47, offset: 125 +/- 9 ms [ServerDate] sample: 48, offset: 107 +/- 9 ms [ServerDate] sample: 49, offset: 89 +/- 9 ms [ServerDate] sample: 50, offset: 71 +/- 9 ms

NodeGuy commented 3 years ago

Hi, I don't know what caused your problem but I've just rewritten the library from scratch and the new version may work better for you.