I want to synchronize the time with NTP over JavaScript. The client can be a normal pc or a smartphone or tablet. The connection could be WLAN or 3G, etc.
I already found this questions and sites
- how to get ntp time from through javascript
- JavaScript NTP time
- Synchronize time in javascript with a good precision (>0.5s) (NTP-like)
first and second links using the a timestamp from this server: .json
But the date object has only second precision. I want a better precision, if possible ~ 10 ms. (I know the precision depends on the connection and round trip time)
Edit: 10 ms is almost impossible. I want the most precision offset.
The third link shows a JavaScript library, but it does not use a direct connection to a ntp server. The solution of the fourth link is most near to that what I want. But its for synchronizing two clients through a 'own' server. Is there a way to synchronize it directly to a ntp pool like pool.ntp
?
I want to synchronize the time with NTP over JavaScript. The client can be a normal pc or a smartphone or tablet. The connection could be WLAN or 3G, etc.
I already found this questions and sites
- how to get ntp time from through javascript
- JavaScript NTP time
- http://jehiah.cz/a/ntp-for-javascript
- Synchronize time in javascript with a good precision (>0.5s) (NTP-like)
first and second links using the a timestamp from this server: http://json-time.appspot./time.json
But the date object has only second precision. I want a better precision, if possible ~ 10 ms. (I know the precision depends on the connection and round trip time)
Edit: 10 ms is almost impossible. I want the most precision offset.
The third link shows a JavaScript library, but it does not use a direct connection to a ntp server. The solution of the fourth link is most near to that what I want. But its for synchronizing two clients through a 'own' server. Is there a way to synchronize it directly to a ntp pool like pool.ntp
?
-
Pinging 8.8.8.8 with 32 bytes of data: Reply from 8.8.8.8: bytes=32 time=68ms TTL=44 Ping statistics for 8.8.8.8: Packets: Sent = 1, Received = 1, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 68ms, Maximum = 68ms, Average = 68ms
How are you going to get sub 10ms with that? – starbolin Commented Jun 5, 2012 at 16:50 - You might be interested in Sync JS time between multiple devices, which offers many solutions. – Bergi Commented Jun 5, 2012 at 16:57
- @Bergi This is abou synchronization, but not with NTP – timaschew Commented Jun 5, 2012 at 17:04
- @starbolin The error ist worst case is only half of the round trip time. Okay 10ms isn't possible. I want only the most precision value. – timaschew Commented Jun 5, 2012 at 21:22
- No, the uncertainty, without clock disciplining, is the difference between the best case one way time and the worst case one-way time. Which may, at times, be more than the average round trip time. Worst case time is not garanteed in a best-effort network ( TCP/IP ). – starbolin Commented Jun 6, 2012 at 3:31
1 Answer
Reset to default 1An NTP client servos the puter's own internal clock for resolution. The client must estimate UDP round trip times and change the inernal clock rate ,slowly, to minimize the average error.