PeeCee wrote (on Fri, 12 Jun 2009 16:36:18 +1200):
I had one PC that would maintain good accuracy when left running on a Bios
screen or booted from a Linux CD or for that matter if left off.
Time keeping in Windows was just as good until 'one' particular application
was started when it would immediately start loosing 2-3 hours per day.
As it was a till monitoring system it needed to be running most of the day.
Which means the RTC was *not* being used to maintain the clock. You are
using the OS clock at that point, NOT the real-time chip on the mobo
that is used to keep track of time while the host is powered down.
I wasn't convenient to reinstall the OS and the software so I just set it to
get it's time from another PC on the LAN that wasn't lumbered with the
problem software.
Eventually a new PC was installed and the problem went away.
So all that goes to confirm software can interfere with the RTC.
No, you just proved the point that intensive applications running under
the OS can affect the OS clock. That does nothing regarding the time
being recorded in the RTC. If you had a host whose system clock was way
off and powered it down and back up, it syncs back to the time that is
being separately tracked by the RTC.
The "system clock" in Windows is Windows maintaining that counter. It
doesn't poll the RTC to find out what it says is the current time. The
RTC is used to generate a Real-Time Clock Interrupt that can update the
OS counter. Programs can issue stop clock interrupts plus the
instructions for the applications are being processed by the same CPU
receiving the interrupts (which get queued as to when they are handled).
RTC interrupts to the CPU can be missed (because they were ignored when
stopped). The OS' "system time" is based on the clock interrupts from
the CPU that it sees, not the ones that are missed, stopped, nor from
the RTC itself. That the RTC sends an interrupt that the OS can use is
NOT the same as what the RTC tracks for time. An interrupt simply tells
the CPU to tick away another increment of time. It does not report the
recorded time.
Think of it this way: once per minute someone nudges you in the side to
remind you that one minute has elapsed. They don't report the time to
you. They just give you a nudge at 1-minute intervals. They get
distracted, need a bathroom break, need a 2nd cup of coffee to wake up,
get a phone call while trying to recover from their computer crashing
while their boss is standing over them demanding a status report while a
hot cup of coffee spilled on their lap, or they get called to a meeting
so your nudging gets put on hold, so they don't get around to nudging
you for awhile. Not until you get another nudge do you increment your
counter again. The next day you arrive and your friend tells you what
time is on his watch and the 1-minute but possibly interrupted nudging
begins again. You start with a known time but thereafter all you have
to track the passage of time is to know when those 1-minute nudges
happen but which may be longer than a minute apart at times.
http://en.wikipedia.org/wiki/Intel_8254
The time gets updated when the system powers up and uses the RTC.
Thereafter, clock ticks (interrupts) are used to monitor the passage of
time. The RTC still knows what time it is tracking. Everyone else
thereafter (i.e., the OS) has to use a counter based on the clock ticks.
Also, it is possible to disable interrupts from devices in the system,
including the clock interrupt from the timer; see
http://www.arl.wustl.edu/~lockwood/class/cs306/books/artofasm/Chapter_17/CH17-3.html.
http://www.intel.com/technology/itj...Thermal_Management/p04_experiment_results.htm
"The OS uses a periodic clock interrupt to keep track of time, trigger
timer objects, and schedule application threads. While the default
interrupt rate is set by the OS, applications can increase the interrupt
rate to any desired frequency (as low as 1ms)."
So it is by the nudges that the OS tracks time, not by getting the
reported time tracked by the RTC itself. With 1-minute nudges, how much
time has elapsed after getting 10 nudges? Maybe 10 minutes. Could be
longer if that nudging was stopped or delayed for awhile.