Date: Wed, 28 Feb 1996 14:15:50 +0200 (IST) From: Eli Zaretskii To: Erik Luijten Cc: djgpp Subject: Re: time measurement in protected mode? In-Reply-To: <9602281152.AA20955@tntnhb3.tn.tudelft.nl> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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).