[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: clocks



The 'hardware clock' is a standalone piece of hardware (it can run without power from
the motherboard, getting it's power from a battery), and is sometimes referred to as
the Real Time Clock because it only measure "Real" (wall clock) time. This clock is
the reason when you turn your PC off and then turn it back on again that your PC has
the correct time. The 'system' time is real time but is maintained by the regular CPU.
A programmable timer on the motherboard is programmed to deliver interrupts at fixed
intervals (100 times per second on x86 boxes, some greater value on alphas). When this
interrupt is triggered code in the kernel increments a counter which keeps track of
the system time. Do 'cat /proc/interrupts ; uptime' and you'll see that interrupt 0
has been generated a great number of time. This interrupt is the one driving the
system time. Now take that number and divide by 100 to get seconds, by 60 to get
minutes, etc. and you'll see that you arrive at the same time which 'uptime' reports.

Now, when you ask the kernel for the time of day, it gives you the time according to
its own internal count. The hardware clock is only consulted at boot time. Due to this
fact, if you change the system time you need to set the hardware clock also if you
want your changes to be in effect the next time you boot your machine.

Now, the problem that affects many users is that they install their linux system is
that they answered incorrectly when the installation program asked them whether or not
their hardware clock is set to UCT (if this is your case don't feel bad, it's a
confusing question). You see, unix systems keep track of time internally in UCT time
only. Although it makes most sense to set your hardware clock to UCT Windoze systems
don't like this and want the hardware clock to run on 'local' time. So, if you have a
dual boot machine and don't live in GMT then you don't want to change this. For this
reason on system startup your system date/time is set from the hardare clock but the
program needs to know whether or not your hardware clock is running UCT or local time.
So, if your time is off by four hours too early (I see you're at CMU and thus on
Eastern Time) this is your problem. To fix this you need to edit /etc/default/rcS (I'm
assuming your system is slink) and look for the line:

# Set GMT="-u" if your system clock is set to GMT, and GMT="" if not.
GMT="-u"

and change this to

# Set GMT="-u" if your system clock is set to GMT, and GMT="" if not.
GMT=""

If the above was not your problem perhaps you can be more specific.

Aaron Solochek wrote:

> Ok, I've read man pages, and I'm still confused.  What different types
> of clocks are there?  I know of the system and hardware, but I'm not
> sure which is responsible for what.  I also would like to know how to
> set everything because I think my system time and/or date is wrong.  Or
> maybe its my hardware time and/or date.....  Can someone explain?
>
> -Aaron Solochek
>  leko@cmu.edu

--
Jens B. Jorgensen
jjorgens@bdsinc.com



Reply to: