[ntp:questions] Getting the time from NTP (was: Re: help with setting up NTP on windows with a USB GPS)

David J Taylor david-taylor at blueyonder.not-this-bit.nor-this-part.co.uk.invalid
Sun Dec 6 06:50:38 UTC 2009


"Dave Hart" <davehart at gmail.com> wrote in message 
news:2c2ad514-3566-4a8f-a5eb-fa62c737ac73 at m7g2000prd.googlegroups.com...
[]
> I am guessing you're actually in a better position than me to provide
> a DLL exposing a function to get the time from ntpd.  There is no way
> other than a NTP packet to request a timestamp from ntpd.
> Additionally, if ntpd is busy, it may take some time for ntpd to send
> its response.  You'll get a very good idea of the time when you
> receive the response, but not necessarily of the time you requested
> the time.  Since waiting on ntpd is involved, such a function could be
> provided with a nonblocking option where the caller is given a socket
> to select for readability while awaiting the response, and calls back
> after its readable to retrieve the time.
>
> Cheers,
> Dave Hart

Dave, thanks for that.  I must be missing something here, although I 
haven't been able to check the source code.  Is there not a routine 
somewhere inside ntpd.exe which timestamps the packets in response to a 
request over the network?  How else are the packets timestamped?  Could 
not that routine be exposed, or the variables it uses?  Yes, I can write a 
DLL (in Delphi/Pascal) it I could get access to the data and algorithms, 
but it seems to me far easier to re-use the existing NTPD code.

I must confess to not having looked at NTP packets from Windows servers 
for a while - don't tell me they have 10-15ms resolution!

Cheers,
David 




More information about the questions mailing list