[ntp:questions] Re: ntpd, boot time, and hot plugging

David L. Mills mills at udel.edu
Fri Feb 4 04:25:13 UTC 2005


The code I see in the ntpdate source does an adjtime() for all offsets, 
even large ones. I don't see a settimeofday() or equivalent. Thus, if 
you run ntpdate and it produces a large correction (maybe a second or 
more), you should wait until that adjustment is made before starting 
ntpd. That's about 2000 s of wait for a 1-s adjustment with stock Unix 
kernels and slew rate 500 PPM. You wouldn't have to wait that long for a 
Solaris kernel, but you would have to wait. Why not give up and use the 
-g option?


Tom Smith wrote:

> Alain wrote:
>> So, if I manage to set the initial time within a good aproximation od 
>> "real" time using ntpdate using 5 servers as explained earlyer, would 
>> you recomend to delete the drift file and let it start all over again?
>> Does this afect the time for the server to start serving?
> I assume you asked this of me, rather than of Dave. Your method
> seems to me to excellent.
> If you do that, there should be no need to clean out the
> characteristic drift that was so carefully computed over a long
> period of time. Cleaning out the drift file is a drastic measure
> required only if you do NOT pre-set the clock before starting ntpd
> and you end up, as a result, with a bogus re-calculated drift rate.
> What you have to calculate into the boot time is the time you have
> to block while stepping the clock to the "right" time in the first place.
> Putting ntpdate into the boot sequence means that time will be however
> long it takes for ntpdate to complete, exactly that long, and no longer
> and that when ntpdate completes the rest of your boot sequence, including
> ntpd is "safe". That's why people are unhappy about ntpdate being
> removed without an equivalent way of doing the same thing with
> ntpd:
> 1) step the clock to a "good enough" time
>       do this within a few seconds
>       block while doing it
>       don't touch/change the pre-computed drift while doing this
> 2) start ntpd
> 3) start time-dependent services
> It would certainly be possible for ntpd to do this all by itself,
> but unless I misunderstand, the only way to do this with just
> ntpd at the moment is:
> 1) ntpd -gq
> 2) sleep [guess how long ntpd -gq will take, worst case, to set the clock]
>    -or-
>    spin on ps looking for ntpd to start and then end
> 3) start ntpd [normal operation options]
> 4) start time-dependent services
> Which is not the same thing.
> ________________________________________________________________________
> Tom Smith                       smith at alum.mit.edu,smith at cag.lkg.hp.com
> Hewlett-Packard Company                          Tel: +1 (603) 884-6329
> 110 Spit Brook Road ZKO1-3/H42                   FAX: +1 (603) 884-6484
> Nashua, New Hampshire 03062-2698, USA           Mobile: +1 978 397 3411

More information about the questions mailing list