A method and apparatus for handling an interrupt from a real-time clock to increment
a program clock in a computer system while compensating for missed interrupts due
to contention on a system bus from a DMA controller or the like. In accordance
with the invention, a count is stored representing a cumulative interval of time
that has elapsed without a corresponding incrementing of the program clock. In
response to an interrupt from the real-time clock, the processor transfers control
to an interrupt handling routine, which determines the interval of time that has
elapsed since the previous real-time clock interrupt and increments the cumulative
interval of time by the actual interval of time that has elapsed since the previous
real-time clock interrupt. If the cumulative interval of time is greater than an
expected interval of time between real-time clock interrupts, the interrupt handling
routine iteratively increments the program clock and decrements the cumulative
interval of time to reflect incrementing of the program clock until the cumulative
interval of time is less than the expected interval of time between real-time clock interrupts.