www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/19/08:39:51

Message-ID: <8D53104ECD0CD211AF4000A0C9D60AE30130456A@probe-2.acclaim-euro.net>
From: Shawn Hargreaves <ShawnH AT Probe DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: high resolution timer
Date: Mon, 19 Apr 1999 14:38:56 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.0.1460.8)
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii writes:
> To solve your problem, either reprogram timer 2 (instead of the 
> system timer 0, like `uclock' does) and use it in the same way 
> as `uclock'; or program the CMOS clock to generate interrupt 70h 
> every 976.6 microseconds and install a handler that counts these 
> interrupts.

Be aware, though, that timer 2 isn't emulated very well under win95, 
so this may not work reliably there. The CMOS should in theory be
a totally reliable solution, but when I once tried to implement this
in Allegro, a lot of people had problems with it. I never figured out
exactly why this was, and it could of course just have been an error 
in my code, but my best guess is that it was due to the motherboard
and BIOS combination. So be warned: neither of these methods are
likely to work on all machines and operating systems.

If you are already using timer 0 in your program, is there any way
you can get time delay information from the same code that is
generating the interrupts? That won't give really fine precision, 
but should be fine up to 1/200 or so of a second. Another option
would be to use the Pentium clock register, but that wouldn't
work on 486 and below...


	Shawn Hargreaves.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019