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

Dave Hart davehart at gmail.com
Sun Dec 6 07:30:13 UTC 2009


On Dec 6, 6:50 UTC, "David J Taylor" wrote:
> "Dave Hart" <daveh... at gmail.com> wrote
> > 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.
>
> 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?  

If we wanted to define a new Windows-only service provided by ntpd,
sure, there could be some combination of shared memory and IPC objects
like named events used to expose a way for another program to ask ntpd
to go down its timestamping path and provide the result.  There's no
need on non-Windows systems where the system clock is high precision
and typically interpolated.  Such a mechanism would be a potential
local DoS avenue again unique to Windows, which while popular in
general, isn't the center of the NTP universe.

The reason I suggested you are in a better position than me to provide
that capability is you've already written code that runs on Windows
and retrives the time via a NTP request/reply pair of packets.  Wire
it to [::1]:123 and/or 127.0.0.1:123 and there's your ntpGetTime().

Cheers,
Dave Hart




More information about the questions mailing list