www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/17/07:11:10

Message-ID: <3308E21F.26D6@post.comstar.ru>
Date: Mon, 17 Feb 1997 14:56:31 -0800
From: Dim Zegebart <zager AT post DOT comstar DOT ru>
Reply-To: zager AT post DOT comstar DOT ru
Organization: zager AT post DOT comstar DOT ru
MIME-Version: 1.0
To: Schuster <Schuster AT eev DOT e-technik DOT uni-erlangen DOT de>
CC: DJGPP Mail List <djgpp AT delorie DOT com>
Subject: Re: exact timming : Q: How exact? OOPS ;)
References: <199702111201 DOT NAA17664 AT atrey DOT karlin DOT mff DOT cuni DOT cz> <5e10ub$479u AT elmo DOT cadvision DOT com> <330889A4 DOT 3C4B AT eev DOT e-technik DOT uni-erlangen DOT de>

Schuster wrote:
> 
> Calvin French wrote:
> 
> > Why not pick up Allegro? Allegro has excellent high precision timer
> > routines. If you like, you can also pick up my small library atimer
> > (x2ftp.oulu.fi/pub/msdos/programming/djgpp2/atimer.zip) which requires
> > Allegro but provides additional flexibility / ease of use.
> 
> How exact can timing be done. I have an application, where i'd
> need 0.1 ms exact timing, could this be done with allegro ?
For many years I'm using an exellent book "Programmers's Problem Solver
for the IBM PC, XT&AT" by ROBERT JOURDAIN.1986 by Brady Books.
It still have many usefull hints and solutions...
...timer ticks 1.192.180 times per second...
It's mean you may have 1 microsecond resolution in you programm... ;)
How to do it ?
Just look at install_timer in timer.c (I talk about Allegro)

   for (x=0; x<4; x++) {
      if (i_love_bill)                   //I think it's when you run
under WindowZ
         set_timer_rate(timer_delay);
      else
         set_timer(timer_delay);         //I think it's when you run
under DOS
   }

if you need 1/100 sec. resolution set timer_delay=1193180L/100  (100
ticks per second)
Place your time-critical code into my_timerint() function (timer.c) and
rebuild liballeg.a

-- 
Regards,
Dim Zegebart,
Moscow Russia.

- Raw text -


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