wxRuby Documentation Home

Wx::StopWatch

The StopWatch class allow you to measure time intervals. For example, you may
use it to measure the time elapsed by some function:

StopWatch sw; CallLongRunningFunction(); LogMessage("The long running function took sw.Time()); sw.Pause(); … stopwatch is stopped now … sw.Resume(); CallLongRunningFunction(); LogMessage(“And calling it twice took $ldms in all”, sw.Time());

See also

::StartTimer, ::GetElapsedTime, Timer

Methods

StopWatch.new

StopWatch#pause

pause()

Pauses the stop watch. Call StopWatch#resume to resume
time measuring again.

If this method is called several times, Resume() must be called the same
number of times to really resume the stop watch. You may, however, call
Start to resume it unconditionally.

StopWatch#resume

resume()

Resumes the stop watch which had been paused with
StopWatch#pause.

StopWatch#start

start(%(arg-type)Integer% milliseconds = 0)

(Re)starts the stop watch with a given initial value.

StopWatch#time

Integer time()

Returns the time in milliseconds since the start (or restart) or the last call of
StopWatch#pause.

[This page automatically generated from the Textile source at 2023-06-09 00:45:32 +0000]