[ntp:questions] Automatic time synchronization of local hw clock.

William Unruh unruh at invalid.ca
Mon Apr 14 21:28:31 UTC 2014


On 2014-04-14, Harlan Stenn <stenn at ntp.org> wrote:
> Mimiko writes:
>> On 14.04.2014 13:01, Harlan Stenn wrote:
>> > I would expect ntpd -q to correct the system clock, not the BIOS clock.
>> 
>> So ntpd has nothing to do with hardware clock.
>> 
>> >> >This is the command line which starts ntpd as service:
>> >> >
>> >> >/srv/ntpd/bin/ntpd -p /var/run/ntpd.pid -g -l /srv/ntpd/log/ntpd.log -s
>> >> >/srv/ntpd/log/ntpstats/  -c /srv/ntpd/etc/ntpd.conf -u
>> > OK, thanks - that looks good.
>> 
>> Yes, but -g option didn't prevent ntpd to fail when system time 
>> difference was 1 hour.
>
> I would like to see the log files for that situation.  I suspect a
> different problem.  When -g is given we allow the maximum possible time
> adjustment for the initial time correction.  Only after that has been
> done do we re-enable the "panic limit" that defaults to 1000 seconds.
>
>> > You might want to consider running a cron job from time to time to set
>> > the BIOS clock from the system clockc, if ntpd is not updating the BIOS
>> > clock for you.
>> 
>> Well, I added a cron job like this:
>> 0 * * * *  root  /sbin/hwclock -w --localtime
>> 
>> for every hour.
>
> NTP uses UTC, not localtime.  So at startup, if the OS sets the clock
> using the BIOS clock it will use localtime instead of UTC, and in 23 out
> of 24 areas of the world, that will be different from UTC.

That depends on the OS and its setup. If the OS knows that the rtc is
on localtime it can compensate in setting the system clock. But that
means you have to have told your OS that your rtc is on localtime and it
has to do something with that information. 

That also means that twice a year you will have to go in by hand and
reset the rtc and the system for daylight saving time. 

Under any unix derivative the system time is UTC (or for some TAI) 
Under Windows it can be local or UTC. 

ntp internally always uses UTC as you say.

>
> H



More information about the questions mailing list