Re: Consistent Gaming Speeds (was Re: Double clicking the mouse)

Search this archive.

From: Martijn van Oosterhout (kleptog@cupid.suninternet.com)
Date: Mon 20 Mar 2000 - 18:10:05 IST


Anson Parker wrote:
> 
> Hey Jay,
> The main bummer is that there's no truly cross-platform way of keeping
> track of micro
> seconds or any sub-second timing (which is not to say there aren't
> some fairly OK ways
> of doing it). But once I sorted this, every time my main loop runs it
> computes the time
> difference since it was last run. Then it's simply a matter of
> calculating things in a time-based
> manner, rather than per-loop.

AFAIK, all UNIX systems implement gettimeofday() which generally gives
sub-second timing (better on some archs than others, i386 rocks in this
respect). On Windows I've used RDTSC directly, which gives you the
same results as gettimeofday() but with greater difficulty.

-- 
Martijn van Oosterhout <kleptog@cupid.suninternet.com>

Trust the computer industry to shorten "Year 2000" to Y2K.
It was this kind of thinking that caused the problem in the first place.


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:23 IST