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

Re: Laptop loosing time



Daniel Senderowicz wrote:
Rick,

Thanks for the explanation.

I knew kernel hacking would come in useful at some point.


So, either resynchronize the software clock to the hardware clock
on a regular basis,


What would be the best setup to do this?

Well, add an entry to root's crontab to do a "hwclock --hctosys" every so often--perhaps every 15 minutes or so:

0-59/15 * * * * hwclock --hctosys

I'd also comment out the following line in /etc/rc.d/init.d/halt:

	runcmd $"Syncing hardware clock to system time"
		/sbin/hwclock $CLOCKFLAGS

(I split the line for readability).  It should be somewhere around
line 113 in the file.  The reason is that this does the
"hwclock --systohc" command, and since your system clock ain't too
reliable, I sure as hell wouldn't want it to muck up the hardware
clock.

However, I use ntp so this isn't an issue for me.  Your mileage may
vary.  Void where prohibited.  This is not a warranty.  Etc., etc.

Daniel Senderowicz wrote:

Robert,



'Twould appear that something is eating enough processor time to cause
it to miss clock interrupts, and cause the clock to "run slow".  Next


I don't understand this. I thought that the hardware clock is a
piece of logic (counters) totally independent of the CPU, therefore
whether the CPU runs busy or not wouldn't make any difference. What
should be running on interrupts is the transfer of the data from
the hardware clock registers to the system clock and if the system
is busy, then it may miss a few transfers but whenever it gets it,
it will be OK, or am I missing something here?

Speaking as a kernel geek, the hardware clock is, essentially, a big counter that's clocked by either the CPU clock source or an internal crystal). As long as the clock source is stable AND the scaling between clock cycles and the counter are correct, it should be fairly accurate (the clock runs when power is off via the lithium battery on the mobo--it doesn't simply keep your BIOS settings alive).

The software clock is a software counter that's clocked by an
interrupt, typically the one on IRQ0.  If the system spends an
inordinate amount of time in interrupt handlers of higher priority
(IRQ0 is the lowest priority), you may miss clock increments.

Many graphic cards make use of IRQ9, normally tripped during vertical
retrace.  If your X driver is inefficient, this can also lead to
lost clock increments.  There are certain DMA operations that can
cause interrupts to occur, and again, ineffecient coding can lead to
lost clock increments.  And so on and so on.

So, either resynchronize the software clock to the hardware clock
on a regular basis, or use something like ntp to keep it in line.
Of the two, I prefer ntp but that depends on your ability to get to
an ntp server.




_______________________________________________
Redhat-install-list mailing list
Redhat-install-list redhat com
https://listman.redhat.com/mailman/listinfo/redhat-install-list



-- ---------------------------------------------------------------------- - Rick Stevens, Senior Systems Engineer rstevens vitalstream com - - VitalStream, Inc. http://www.vitalstream.com - - - - Dyslexics of the world: UNTIE! - ----------------------------------------------------------------------





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