Sample Code in Perl or in C
Network Time Protocol is a way to keep computers clocks correct. It works by propgating the time in such a way as the errors don't add up a great deal and the amount of error can be caluated and adjusted for. A poorly maintained NTP cluster will typicaly maintain its time within a second if only one of the computers can talk to a good clock once in a while.
All the details can be found At the NTP web site.
If your going to start working on NTP, I would recomend starting with the oboslite RFC 1059 because it is well written and easy to understand. It only discusses protocol version 1 but later protocols documents were written assuming a knowledge of version 1. Later documents get in to some strange concepts that most applications don't need.
Never use a public server that you do not run as a default NTP server. The standards groups do not have the finances to run the needed hardware and network lines to support large numbers of users. Please do not abuse their systems.
For most applications, a stratum 4 or 5 server will be good enough. These will typically provide time better than a typical TV station and well under a second of accuracy. Most internet routers these days use NTP to coordinate their internal clocks and work as good NTP servers. You can ask your ISP if they provide an NTP server for your use (it will tend to have a name like clock.myisp.com or ntp.myisp.com). Chances are their routers are set up to provide NTP servers so can find out by running traceroute which will give you a list of routers. Try them starting to the closest until you find one that works and use it.
I have a small script that will find out routers near you that might run NTP servers. Locate NTP servers. The script might take several minutes to run.
|Back to Tim's Homepage||Back to current subject||Related Linksemail@example.com|
|This page was last updated Saturday, 08-Dec-2007 00:05:47 UTC||Copyright 2000-2013||thogard is a trademark of Tim Hogard|