From: tmoran@acm.org
Subject: Re: Ada, games and frame rate calculation
Date: Wed, 16 Feb 2005 20:33:34 -0600
Date: 2005-02-16T20:33:34-06:00 [thread overview]
Message-ID: <gfOdncKYaInjn4nfRVn-ig@comcast.com> (raw)
In-Reply-To: mailman.148.1108601724.527.comp.lang.ada@ada-france.org
> You can read the clock with microsecond precision (on Windows and some
> other platforms); you can only delay with an accuracy of about 10
> milliseconds (again on Windows).
That depends on how you delay. There are Windows calls for delays, but
you can also have a spin delay whose accuracy is limited by the clock
tick, clock reading time, and maximum delay caused by other tasks.
e.g.
Go_Time := Ada.Calendar.Clock+0.000_058; -- delay 58.0 microseconds
while Ada.Calendar.Clock < Go_Time loop delay 0.0;end loop;
(But note this can fail on some motherboards where the clock jumps forward
several seconds if you re-read it too fast.) Most, but IIRC not all,
compilers' run-times will do a "delay 0.0;" very fast if nothing else
needs to run.
I believe the Janus system calls Windows for long delays but does its
own task management for short delays.
next prev parent reply other threads:[~2005-02-17 2:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-16 21:32 Ada, games and frame rate calculation Luke A. Guest
2005-02-16 22:16 ` Stephen Leake
2005-02-16 23:03 ` Luke A. Guest
2005-02-17 0:55 ` Stephen Leake
2005-02-17 2:33 ` tmoran [this message]
2005-02-17 8:39 ` Dmitry A. Kazakov
2005-02-17 23:23 ` Randy Brukardt
2005-02-19 14:48 ` Simon Wright
2005-02-17 0:06 ` Jeffrey Carter
2005-02-17 2:33 ` tmoran
2005-02-17 22:08 ` Simon Wright
2005-02-18 0:06 ` Jeffrey Carter
2005-02-18 5:30 ` tmoran
2005-02-19 0:03 ` Jeffrey Carter
2005-02-19 0:45 ` tmoran
2005-02-19 22:19 ` Jeffrey Carter
2005-02-18 9:04 ` Adrien Plisson
2005-02-18 9:19 ` Vinzent 'Gadget' Hoefler
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox