Subject: Re: Clockticks lost, why ?
To: Christoph Ewering <eweri@uni-paderborn.de>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: port-mac68k
Date: 01/29/1997 08:19:25
On Wed, 29 Jan 1997 11:48:28 +0100 (MET) 
 Christoph Ewering <eweri@uni-paderborn.de> wrote:

 > >  - Access to the RTC is expensive, and
 > 
 > Sorry, I don't know how difficult it is to get the time from the RTC and
 > how much processtime is lost.
 > How about a /dev/rtc ? So every process can call the RTC if it is in the
 > need of an exact time.

It's not that it's difficult, per se, but rather it takes a log time
to do a load from or store to the RTC.  Access to the RTC must be
atomic, which means that you'll go to splhigh() to do the access, which
means losing more interrupts, etc.

A /dev/rtc for use by processes to get the system time is a bad
model.  For one, it is not how UNIX does this sort of thing, and would
require changes to lots of code to use it.  Two, someone must convery
the RTC format to something meaningful to a program, and this must be
atomic (see above).

The correct thing to do if you're seeing clock drift is to discipline
the clock with NTP.

 > Don't know exactly how the RTC works, but i think i have to read a
 > 64bit(?)counter form an adresse in the memory, calculate a little, and
 > update the systemtime.

...yes, and reading that memory location may staaaaaaaaaal.  :-)

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939