Measuring interrupted time intervals in Tango

Sean Kelly sean at f4.ca
Tue Jul 24 00:29:25 PDT 2007


Jason House wrote:
> I'm trying to convert some code that amounts to a busy wait.  I'd like 
> to use something very similar to the StopWatch, but I need to let the 
> timer keep going.  Typical use is < 1 second.  What's the best way to do 
> this with Tango?  I guess one way is to start and stop the stopwatch and 
> just add the various results together.  I guess I'm just surprised 
> there's no equivalent to boost's timer::elapsedTime()

You could use WallClock.  Its resolution is well below 1s, and it isn't 
limited in duration like StopWatch.

> I could imagine strange uses with ~ 1 minute or more.  What are the 
> limits of the StopWatch timing method?

Whatever the limits of the underlying OS routines are.  And I'm not sure 
what that is for WinXP offhand.  But Win32 uses a ulong to store the 
number, so it should be well over a minute.


Sean


More information about the Digitalmars-d-learn mailing list