[ntp:questions] ntpd code

Kemal Oral CANSIZLAR ocansizlar at comcast.net
Wed Mar 23 17:49:45 UTC 2005


----- Original Message ----- 
From: <mayer at gis.net>
Newsgroups: comp.protocols.time.ntp
To: "Kemal Oral CANSIZLAR" <ocansizlar at comcast.net>; 
<questions at lists.ntp.isc.org>
Sent: Wednesday, March 23, 2005 9:20 AM
Subject: Re: [ntp:questions] ntpd code


> ----- Original Message Follows -----
>> Hi, Thanks for reply,
>>
>> <mayer at gis.net> wrote in message
>> news:mailman.48.1111595272.588.questions at lists.ntp.isc.org...
>> > ----- Original Message Follows -----
>> >> Hi,
>> >>
>> >> I am trying to modify some portion of NTP source code to maintain a
>> >> high  resolution, precise (as far as NTP goes) logical clock
>> instead >> of modifying  the system clock of the user (as it may not
>> have >> necessary privileges doing  so)... You can view it as
>> intercepting the >> system calls from NTP to  manipulate a software
>> clock; I am not sure >> how successful it would be... The  development
>> and testing environment >> is strictly Windows...
>> >>
>> >
>> > I'm not sure I understand this at all. Why wouldn't you be running
>> > this as a service with the right privileges? If you want to
>> > intercept system calls you probably need privileges anyway (I
>> > haven't looked at the code to verify this). ntpd IS a high
>> > resolution precise logical clock
>> > already. What is it that you are trying to achieve?
>> >
>>
>> OK, What I am trying to do is to prevent updating the SYSTEM clock,
>> but  instead updating an APPLICATION level clock (nothing but a 64 bit
>> variable).  My aim is to collect event data from various users using
>> the application I  am developing, so I will need a way to synchronize
>> the event timestamps to  reflect almost exact times the events
>> occured. But users may not have the  privilege to update the system
>> clock in their machines, so I am simulating  that through manipulating
>> a high level clock. I am not defending this is the  best way to do,
>> but I really couldnot think of any other way doing so. Any  comments
>> are welcomed and highly appreciated!
>>
>
> Why not just install ntpd as a service on each of the machines and
> let it do its thing?
>
> The problem is that once the clock is set it calls
> SetSystemTimeAdjustment()to change the clock and that just makes
> changes to the clock rather than setting the clock to a specific
> value.
>

OK, I understood your point. But I am trying to avoid ANY changes to the 
user's PC, so I am just updating (step and slew) an internal variable 
through Performance Counter for higher resolution (although it is not 
intended for long-term time keeping) without reflecting anything onto 
system.

>> >> I have observed two points in the source code by now...
>> >>
>> >> Is there a reason for the latest 4.2.0 version not using
>> ClockThread >> (in  nt_clockstuff.c) for clock interpolation (high
>> resolution clock >> read)? I  couldnot find a place calling
>> StartClockThread()... >>
>> >> Also, I believe developers/maintainers are already aware, but I am
>> >> guessing  at method service_exit() in ntpd.c source file, the IF
>> logic >> should read
>> >>
>> >> (!debug && NoWinService == FALSE)
>> >>
>> >> otherwise, it would result in error if we were to start the ntpd so
>> as >> not  to run as a Windows service.
>> >>
>> >
>> > You appear to be looking at a rather old version of the source code.
>> > You should get the latest snapshot and use that. StartClockThread()
>> > is in ntclockstuff.c and that logical statement is in ntservice.c in
>> > service_exit. It's not in ntpd.c. The condition is: if (!foreground)
>> > rather than the above.
>> >
>>
>> Oh, I actually downloaded the source code from
>> http://ntp.isc.org/bin/view/Main/SoftwareDownloads
>> There says the latest (stable?) version is 4.2.0 as of 2003/10/15. I
>> would  appreciate if you could give me a link to the latest code.
>> However,  stability is also important in my case...
>>
>
> http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/snapshots/ntp-dev/2005/03/
>
> You can't expect stability here since you are altering the code
> anyway. However, I don't think that there's anything unstable about
> this code especially for Windows.
>

Thank you for the link, I wish I had known it before. I may migrate to 
latest code soon.

> Danny
>
>> Thank you!
>>
>> > Danny
>> >> Regards,
>> >>
>> >> -Kemal.
> 





More information about the questions mailing list