Subject: Re: Clockticks lost, why ?
To: Christopher R. Bowman <crb@glue.umd.edu>
From: Scott Reynolds <scottr@og.org>
List: port-mac68k
Date: 01/29/1997 01:05:53
On Tue, 28 Jan 1997, Christopher R. Bowman wrote:

> Maybe I am just stupidly missing something, but the solution seems obvious
> to me:

No, I'd hardly say you're stupid.  In fact, something useful might happen
here. :-)

> Maybe RTC acces is expensive, maybe it isn't, but I'll bet that that doing
> it every N minutes or so (N in the 5 to 20 mintues range) isn't an undue
> burden.

I suppose that every N minutes isn't an undue burden, but then the amount
of correction you can hope to apply will be a problem, won't it?

> Since we aren't incrementing the system time by a constant but
> instead by a variable we can change this variable.  If we increase the
> variable we in effect run the system (not the RTC) clock faster, if we
> decrease this variable (but keep it positive) then we in effect run the
> system clock slow.

Yes, this is true, and just how adjtime() works (as you may have read).

> So what we want to do is monkey with the variable that we add to the system
> clock so that the RTC time which is relatively stable but of poor
> resolution, and the system time which is of better resolution but not so
> good stability converge.  Kinda like a phase locked loop.

Well, there's a third option, if someone wants to take a look at it.

There is a 1Hz interrupt on VIA1 on all of the machines listed in the
GMFH.  Setting it up properly should be pretty trivial.  I suspect we
could harness this interrupt to discipline the clock, as it's far less
likely to be lost...  any takers?

--scott