www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Measuring interrupted time intervals in Tango

reply Jason House <jason.james.house gmail.com> writes:
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()

I could imagine strange uses with ~ 1 minute or more.  What are the 
limits of the StopWatch timing method?
Jul 23 2007
parent Sean Kelly <sean f4.ca> writes:
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
Jul 24 2007