# wxStopWatch Class Reference
[Miscellaneous]

`#include </home/work/projects/wx/2.9/wx/interface/wx/stopwatch.h>`

## Detailed Description

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());

##

Library: wxBase
Category: Miscellaneous

See also:
  wxTimer

## Public Member Functions

| wxStopWatch ()
| Constructor.
void | Pause ()
| Pauses the stop watch.
void | Resume ()
| Resumes the stop watch which had been paused with Pause().
void | Start (long milliseconds=0)
| (Re)starts the stop watch with a given initial value.
long | Time () const
| Returns the time in milliseconds since the start (or restart) or the last call of Pause().

List of all members.

## Constructor & Destructor Documentation

wxStopWatch::wxStopWatch | ( |  | ) |

Constructor.

This starts the stop watch.

## Member Function Documentation

void wxStopWatch::Pause | ( |  | ) |

Pauses the stop watch.

Call 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.

void wxStopWatch::Resume | ( |  | ) |

Resumes the stop watch which had been paused with Pause().

void wxStopWatch::Start | ( | long | milliseconds = `0` | ) |

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

long wxStopWatch::Time | ( |  | ) | const

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

|  | [ top ]