Mail Archives: djgpp/1997/02/17/07:11:10
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 -