contents up previous next

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/stopwatch.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.