Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
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.
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?
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,
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.