Newsgroups: comp.os.linux.misc Date: 1999/04/13
> I'm having a weird clock problem with my laptop running RedHat 5.2 and > the 2.0.36 kernel. > > When ever I leave the maching idle, eight minutes later the clock will > stop. > > The only thing I am using that might be clock related are APM support > and Real Time Clock support in the kernel and an X/AfterStep app called > asclock (not as root.) Only root is able to set the clock. > > Does anyone have any idea what is going on here?
Yep, your CPU is napping (which it should do on a laptop).
There are two (well, more, really) clocks in Linux: one is the obvious hardware clock, the other is a software clock. The software clock gets incremented 100 times a second at each interrupt. Since reading the hardware clock is relatively slow, when you call the various functions to get the time, it uses the software clock.
The problem here is that your laptop is entering 'standby' mode, and in the process, putting the CPU completely asleep. (Normally standby just does some power reductions to conserve power without knocking out the CPU, but some laptops are weird. Actually, they all are.)
Since your CPU is comatose, it's not going to care about the timer any more, and those 100'ths of seconds will merrily roll past it. That's sort of against the point, eh?
So how to fix it?
See http://www.wpi.edu/~jmhill/LinuxPage/apmdoc1.html for what to do (a simple kernel patch that makes standby mode act more like suspend mode in dealing with the clock).
Brian Moore