hi
while i was using CMOS to get the current time i m having a strange problem.
at the booting time i initilize the CMOS and then get the current time which is exactly right time. but after that first time when i try to use that same function to show current time it shows that the clock is running too fast
e.g for the first time (mean booting time) it showed
Current Time: 9:40:00
then when i try to call this function again after say 4 seconds it will show
Current Time: 9:41:30
now as u see actually it was just 4 seconds and the clock has gone by a minute. and it continues to run this fast
so i need to ask u that why is this happening .. why is it going so fast .. now if i have to use the timer interrupt for keeping record of time ca some one tell me how fast does that go .. i mean how many times it get fired in one second
thans for ur help
CMOS clock running too fast
Re:CMOS clock running too fast
Your timer advanced 90 seconds in 4 seconds of "real" time.
90 / 4 = 22.5
>i mean how many times it get fired in one second
Unless you reprogram the 8253 timer chip, you get interrupts at the rate of 18.2 Hz -- which is pretty close to 22.5 -- hmmmm...
90 / 4 = 22.5
>i mean how many times it get fired in one second
Unless you reprogram the 8253 timer chip, you get interrupts at the rate of 18.2 Hz -- which is pretty close to 22.5 -- hmmmm...
Re:CMOS clock running too fast
Are you testing on Bochs or on a real machine? Bochs is notorious for having its clock running too fast.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:CMOS clock running too fast
if on real hardware, you probably set the PIT frequency to a higher value (18.2*22.5 Hz =~ 400 Hz) and forgot to reset it to a proper frequency (18.2Hz) when you return to DOS ...
As dos calls the INT 18h (iirc) to update the CMOS periodically from IRQ0, a higher timer frequency means a drifting cmos clock ...
As dos calls the INT 18h (iirc) to update the CMOS periodically from IRQ0, a higher timer frequency means a drifting cmos clock ...
Re:CMOS clock running too fast
oh yeah
it was just because of bochs .. on the real computer it works just fine
thanx for ur help
it was just because of bochs .. on the real computer it works just fine
thanx for ur help
Re:CMOS clock running too fast
hehe Too fast, that's an understatement! I have in front of me a custom timer ISR that counts to 18 (it doesn't bother with the .2) and changed a char in vid mem.Tim Robinson wrote: Are you testing on Bochs or on a real machine? Bochs is notorious for having its clock running too fast.
On a real PC it changes once a second. In bochs it's a blurr!
BTW on a Win98 boot floppy in Bochs, the 30 secs you get flash in about 5!
Why don't they sort this bug out? surely it's going to really break someones code (like in this example).
srg