www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/02/28/07:27:44

Date: Wed, 28 Feb 1996 14:15:50 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Erik Luijten <erik AT tntnhb3 DOT tn DOT tudelft DOT nl>
Cc: djgpp <djgpp AT delorie DOT com>
Subject: Re: time measurement in protected mode?
In-Reply-To: <9602281152.AA20955@tntnhb3.tn.tudelft.nl>
Message-Id: <Pine.SUN.3.91.960228140643.12328B-100000@is>
Mime-Version: 1.0

On Wed, 28 Feb 1996, Erik Luijten wrote:

> The accuracy does not have be too high: one second would be ok, 0.01 second
> would be perfect.

In that case, I don't think you should care about mode switches: they 
typically eat up about 1000 CPU cycles (30 microseconds on a 486/33).

> Why do you say: for anything as long as a few hours, if clock() only wraps
> after ca. 24 hours?

Because I don't recommend to get anywhere near the wrap-around.

> gettimeofday() seems ok, but doesn't it require a switch to real mode?

Yes, it does (it calls a DOS function), but I don't think you should 
worry about that for your resolution, see above.

> If so, is there any other timer function (resolution see above)  which does
> not require this switch?

clock() doesn't switch to real mode (it just peeks at a certain address 
in the BIOS data area).  If you need to measure time for longer than 24 
hours, you can augment clock() with gettimeofday() (which you can then 
call once every 24 hours or so).

- Raw text -


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