[LBo] Re: Daylight Saving Time

Anita Lewis ajlewis2 at highstream.net
Sun Jul 9 13:25:34 CEST 2006


On 07/07/2006 01:31 PM Douglas Orchard wrote:
>>   I am a little confused with hardware time. What is the relationship
>>   between hardware time, system time, and time zone?
> 
> Timezones are a convention between countries so people can know what
> time it is in other countries or cities within their own country.
> 	http://www.worldtimezone.com/index24.php
> Hardware time is held in a hardware clock on the motherboard, (resitors,
> capacitors, transistors, etc), and runs off the bios battery.
> System time is held in a software clock and can be easily programmed,
> but only runs when the system is running.
> When the system boots the system clock has forgotton the time, and
> resets itself from the hardware clock (UTC), and then adjusts itself to
> the local offset by reading the timezone file that is identified as
> localtime, (this adjustment includes daylight saving if necessary).
> Adjusting the hardware clock is best done with a package, developed
> especially for that purpose, (my favorite is ntpdate).
> 

Thanks for a great explanation, Douglas.  I'd like to see it on the 
wiki.  Could you do that, or can I do it for you and attribute it to you?

I do have a couple comments.  I am no expert on this, but I was curious 
and started nosing through manpages and init files.  I vaguely recalled 
seeing that the hardware clock got set with the system time on shutdown. 
  I looked in /etc/rc0.d which stuff runs on shutdown and sure enough 
there is hwclock.sh being run.  At the top it says:
--------------------

hwclock.sh    Set and adjust the CMOS clock, according to the UTC
#               setting in /etc/default/rcS (see also rcS(5))

-------------------

In /etc/rcS.d, the place where the things run at every boot no matter 
what runlevel are contained, is the script that sets the system clock at 
boot as you said:
---------------------
hwclockfirst.sh Set system clock to hardware clock, according to the UTC
#               setting in /etc/default/rcS
--------------------

In man ntpdate it says that settimeofday is called which sets the system 
time.  So I would say that ntpdate changes the system time and not 
directly the hardware time.  I do agree that it is best to use something 
like it to do the job, though, and it does get the hardware clock 
changed as soon as shutdown is done.  That's how I read it, anyway.

Anita




More information about the QnA mailing list