[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: software clock better than hardware clock



<gids.rs@sasktel.net> wrote:
>> However, interrupting software clocks are incompatible with software timed
>> routines, so they must have a way of counting interrupts not taken so they
>> don't lose time when interrupts are disabled for more than the interrupt
>> period. (Floppy disk I/O is an obvious case.)
> 
>> A 6522 has both a timer that can be used to create regular interrupts and
>> another counter that can keep track of how many interrupt requests were
>> made while they were disabled, so the software clock doesn't lose time. 
> 
>> Of course, long-term timing accuracy is another matter, since the
>> computer's clock crystal is much less accurate than the "watch crystal"
>> used by a real-time clock. 
> 
> 
> I was not too concerned with accuracy.  My Mac, PC and IIGS all have real
> clocks, and I have to say only the IIGS has a fairly accurate real clock.
>  My PC gains about a minute a month, and the Mac loses about 1 minute every 3 months.
> 
> Also, there is the option to read the real clock every hour on the hour
> to update the accuracy somewhat.  Thus, the computer only works hard at
> reading the real clock once every 3600 seconds.
> 
> And disk I/O would never really get that far out.  Maybe a minute or two
> at the most out of each hour with time stamping.
> 
> I guess the main reason I did this is so I can stare at time on the
> screen, knowing that I wrote an efficient routine to make time fly. ":D

I understand. 

My routine put the time on the top line at the right every second, so it
always reappeared after the old time scrolled off. ;-)

A few seconds of inaccuracy is no problem for time-date stamps, but if you
want to time something that accesses a disk, it's an issue. 

-michael - NadaNet 3.1 and AppleCrate II: http://home.comcast.net/~mjmahon