[ntp:questions] Any samples for NTP/SNTP client code?

Danny Mayer mayer at ntp.isc.org
Mon Dec 3 02:35:07 UTC 2007


guuwwe at hotmail.com wrote:
> On Dec 1, 3:40 pm, hal-use... at ip-64-139-1-69.sjc.megapath.net (Hal
> Murray) wrote:
>> In article <90967f07-83ca-4d79-8acb-1c3056ce3... at l1g2000hsa.googlegroups.com>,
>>
>>  guu... at hotmail.com writes:
>>> Does anybody know of any *practical* samples on how to
>>> implement NTP/SNTP client?. The goal is to provide accurate
>>> time for a program/client running on Windows Vista.
>> Just curious.  Why do you want to roll your own as compared
>> to run one of the existing packages?
>>
> 
>  Existing packages set the PC system/CMOS clock, and my application
>  would have to read it which is not very reliable approach.
>  My app needs direct access to periodic (5-60mins) accurate ***direct*
>   timestamps and it will use high frequency counter provided by PC
>  between.

Can you be sure that you will get a better and more accurate timestamp
that way? You might want to consider using a refclock instead it it's
that important to what you are doing.

>>> Only a narrow description focused on NTP/SNTP request/reply
>>> datagrams for a simple PC client, preferably in C/C++ source
>>> code.
>> I don't know of any good code you can copy.
>>
> 
>  I does not have to be a source code but a description/algorithm by
> somebody
>  who actually coded reliably.
> 
>> I'd start at:
>>  http://support.ntp.org/bin/view/Main/SoftwareDownloads
>> and look in the sntp directory.
>>
> 
>   I did find it. However, the packages use gz formats used by Unix.
>   My PC does not have any utility to uncompress them.
> 
Use Winzip which supports it natively. There are also free binaries
available for gunzip and for tar.

Danny



More information about the questions mailing list