delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/08/17:02:02

From: richard AT stardate DOT bc DOT ca
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Same speed on every machine
Date: Tue, 04 Aug 1998 06:39:44 GMT
Organization: Rapidnet Technologies Internet
Lines: 23
Message-ID: <35c6aaf9.41572229@news.rapidnet.net>
References: <35C396B2 DOT C31C29EA AT aditfree DOT com> <35d43129 DOT 140559707 AT news DOT ican DOT net>
NNTP-Posting-Host: wlp47.rapidnet.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


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