Mail Archives: djgpp/1998/08/04/04:16:09
On Sun, 02 Aug 1998 09:29:03 GMT, 717323666 AT ican DOT net (cam and or
nenette remove trailing 666) wrote:
>On Sat, 01 Aug 1998 23:29:06 +0100, "C.Rothwell"
><enquiries AT aditfree DOT com> added to the entropy with:
>>Is there a fool proof way of getting somethng to run at the same speed
>>on any PC without it slowing down the older machines?
>
>yeah - run it on the slowest machine you want it to run on, and then
>use that as the standard for how fast the program is allowed to run on
>faster machines.
Use a hi res timer;
At the start of a critical section grab a copy of the tick count.
Do the critical section process.
Now use a loop that grabs the current tick count, subtact the stored
tick count, exiting the loop when the diff is >= n ticks .
A do nothing loop of n iterations will not work in all cases because
there are more variables than just cpu speed (like video and hdd).
- Raw text -