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

Re: [MiNT] DATE/TIME cookies



On Fri, Feb 26, 1999 at 05:20:21PM +0100, Petr Stehlik wrote:
> Petr 
> ...still dreaming about code like
> /* in interrupt */
> if (Cookie('MagX') || Cookie('MiNT') >= 0x110) {
>     Tgettime();
>     Tgetdate();
> }
> else {
>     /* use DTCOOKIE or another hack */
> }

When you wake up ;-)  why don't you use code like this:

if (Cookie ("MiNT")) {
  select (...);
  Tgettime ();
} else {
  /* in interrupt */
  /* use DTCOOKIE or another hack */
}

Seriously, I don't understand what you need interrupts for.  Do
you remember the GEM++ sources I send you a year ago or so?  It
contained the sources for a window clock but I never got the idea
to hook into interrupts for that.  If you do an evnt_timer (200)
the clock will run accurate enough for a desktop clock. If you
use a 1000 ms timeout things will also be smooth enough.

If you want to get odd seconds for old kernels or non-MiNT you
can easily do this with "secs += ((*_hz_200 % 200) > 100 ? 1 : 0".
This is crude but also accurate enough for a desktop clock.

Ciao

Guido
-- 
http://stud.uni-sb.de/~gufl0000/
mailto:gufl0000@stud.uni-sb.de

Q:	What looks like a cat, flies like a bat, brays like a donkey, and
	plays like a monkey?
A:	Nothing.