## wxStopWatch

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

        wxStopWatch sw;
        CallLongRunningFunction();
        wxLogMessage("The long running function took %ldms to execute",
                     sw.Time());
        sw.Pause();
        ... stopwatch is stopped now ...
        sw.Resume();
        CallLongRunningFunction();
        wxLogMessage("And calling it twice took $ldms in all", sw.Time());

Include files

<wx/timer.h>

See also

::wxStartTimer, ::wxGetElapsedTime, wxTimer

Members

wxStopWatch::wxStopWatch
wxStopWatch::Pause
wxStopWatch::Resume
wxStopWatch::Start
wxStopWatch::Time

### wxStopWatch::wxStopWatch

wxStopWatch()

Constructor. This starts the stop watch.

### wxStopWatch::Pause

void Pause()

Pauses the stop watch. Call wxStopWatch::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.

### wxStopWatch::Resume

void Resume()

Resumes the stop watch which had been paused with wxStopWatch::Pause.

### wxStopWatch::Start

void Start(long milliseconds = 0)

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

### wxStopWatch::Time

long Time() const

Returns the time in milliseconds since the start (or restart) or the last call of wxStopWatch::Pause.