[ntp:questions] 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
Wed Dec 2 07:29:14 UTC 2009
> David,
>
> I looked at timeGetTime() and I found it only gives out relative time
> (since Windows was started). Is it possible to query NTP server to get
> an accurate starting time?
>
> jack
As Dave Hart says, you would need to do a network transfer to get the time
from NTP - that's a bit of a pain when it's running locally. A pity that
Dave's new DLL couldn't include a very simple get current time call! Hint
Dave! Call: GetNTPTime - returns a 64-bit value. However, a network
query should take less than a millisecond on the local PC, so you could
then use the timeGetTime function. The ambiguity is around 49 days, so it
shouldn't be an issue. The other much more accurate way /may/ be to use
QueryPerformanceCounter - a 64 bit counter running at either a few MHz or
even at CPU-speed. Yes, it would need calibrating, and you may also have
to deal with CPUs where the speed changes (also an issue for NTP), and
there may also be an ambiguity issue.
If you go the SNTP route, the packet you need is easy to construct, and
it's on page 7 here:
http://www.ietf.org/rfc/rfc2030.txt
It's what my Delphi SNTP monitor program uses, and has about a dozen
fields to complete.
http://www.satsignal.eu/software/net.htm#NTPmonitor
73,
David
More information about the questions
mailing list