Page 1 of 1
System Clock or Time
Posted: Sun Dec 08, 2002 3:35 pm
by Slasher
hello everyone,
what do you guys think? is it better to use the Real Time Clock (through CMOS) for the system time or is Timer 0 (int 08 in real mode) better for keeping the system's time?
thanks.

Re:System Clock or Time
Posted: Sun Dec 08, 2002 3:37 pm
by jrfritz
I think the timer that the IDT uses is better.
Re:System Clock or Time
Posted: Sun Dec 08, 2002 3:38 pm
by jrfritz
That way, you could control of the timer and stuff....
Re:System Clock or Time
Posted: Sun Dec 08, 2002 3:52 pm
by Slasher
hi,
I'm not talking about timer interrupts! let me see if i can explain better.
Most of us are using Timer 0 for task switching, so I'm thinking the code for switching tasks will through the time off balance(reduce accuracy) so i was like at a certain time, for example, i set my Timer 0 to 1Khz (1000 ticks per sec) so at the 1000th tick i read the CMOS and display the read time, for my system time.
Is this good or is it better to just count ticks in Timer 0 and then when it is 1000 (for my example) perform the necessay calculations to convert to seconds,minutes and hours?

Re:System Clock or Time
Posted: Sun Dec 08, 2002 6:01 pm
by Tim
You could count ticks and hours/minutes/seconds. Every 1000 ticks you could read the RTC and make sure your own hours/minutes/second variable is accurate,
Re:System Clock or Time
Posted: Sun Dec 08, 2002 7:36 pm
by Curufir
Gotta go with Tim on this one, you should use a combination of PIT and counter variable for immediate and correct by a reference to the RTC every now and again.
AFAIK this is how most operating systems do it because to use RTC all the time would be too slow, and to use only the PIT + counter method is too inaccurate over any long period (Long here meaning anything over a minute or so).
Bear in mind that so long as you're not making a real time OS where timings are absolutely critical then you can get away with the system clock having an accuracy of +/- 2 seconds or more. Most of the time the user isn't even going to notice.
Re:System Clock or Time
Posted: Sat Jan 04, 2003 8:48 pm
by Perica
..
Re:System Clock or Time
Posted: Sun Jan 05, 2003 5:42 am
by whyme_t