[ntp:questions] Re: This is tougher than I thought?

Richard B. Gilbert rgilbert88 at comcast.net
Sat Jan 21 14:02:26 UTC 2006


Axonn wrote:

>Hi everybody. My name is Axonn Echysttas and I'm a newbie to NTP. I'm
>currently working at developing a replacement for the Windows OS
>Systray clock. This program is free and I've been working on it for
>the past year a lot. It will enter Beta 2 no later than 25 January this
>year and Beta 3 (which will be public) probably during March this year.
>However, for the time being, even though I built a lot of functionality
>and it looks quite nice (very flexible and customizable), I didn't
>yet start on NTP time synchronization. I got the RFC about NTP and it
>scared me a little to see all those math formulae in it. On
>http://tf.nist.gov/service/its.htm I read that "The NIST servers
>listen for a NTP request on port 123, and respond by sending a udp/ip
>data packet in the NTP format. The data packet includes a 64-bit
>timestamp containing the time in UTC seconds since January 1, 1900 with
>a resolution of 200 ps."
>
>My question is this: could you help me for a good cause? I would like
>to know how does the NTP format look like and how to take an accurate
>time out of it. I suppose I can always start reading and searching by
>myself, of course. But this thing doesn't look very easy at the first
>glance. Also, the amount of documentation on NTP seems huge. I don't
>know if the client-side NTP involves a lot of math but if it does,
>I'm not that good at math yet. I didn't yet graduate University and
>my school is on freeze for the last two years since I need to work to
>sustain my family. However, this project of mine I did in my free time
>and for the pleasure of doing something good and helping others, I will
>never request money for it.
>
>So how can I synchronize with a NTP server or more NTP servers? Is it
>so hard as I imagine after going a little through the FAQs? I would
>hope that the hard part is for servers, not for clients. I await your
>answers with great anticipation.
>
>Thank you very much for your time,
>Axonn Echysttas,
>ASD Clock creator.
>
>  
>
I think you ask too much!   The packet format is documented in RFC 1305 
on pages 50 et. seq.   The formula used to compensate for transmission 
delay will be found on page 100.  That should be enough to get you a 
time correct within, say, fifty milliseconds by querying a single 
server, interpreting the reply packet and stuffing the resulting time 
into your clock.  

There is a freely available reference implementation of ntpd and 
associated utilities.  There is even a pre-built version available for 
Windoze.  If you want real accuracy, you will need to implement the 
entire package or use the reference implementation.   With a very good 
server and low network latencies, ntpd is capable of synchronizing a 
client within a few microseconds




More information about the questions mailing list