1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxStopWatch
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
12 The wxStopWatch class allow you to measure time intervals.
14 For example, you may use it to measure the time elapsed by some function:
18 CallLongRunningFunction();
19 wxLogMessage("The long running function took %ldms to execute",
22 ... stopwatch is stopped now ...
24 CallLongRunningFunction();
25 wxLogMessage("And calling it twice took $ldms in all", sw.Time());
28 Since wxWidgets 2.9.3 this class uses @c ::QueryPerformanceCounter()
29 function under MSW to measure the elapsed time. It provides higher
30 precision than the usual timer functions but can suffer from bugs in its
31 implementation in some Windows XP versions. If you encounter such problems,
32 installing a Microsoft hot fix from http://support.microsoft.com/?id=896256
44 Constructor. This starts the stop watch.
49 Pauses the stop watch. Call Resume() to resume time measuring again.
51 If this method is called several times, @c Resume() must be called the same
52 number of times to really resume the stop watch. You may, however, call
53 Start() to resume it unconditionally.
58 Resumes the stop watch which had been paused with Pause().
63 (Re)starts the stop watch with a given initial value.
65 void Start(long milliseconds
= 0);
68 Returns the time in milliseconds since the start (or restart) or the last
76 // ============================================================================
77 // Global functions/macros
78 // ============================================================================
80 /** @addtogroup group_funcmacro_time */
84 Returns the number of seconds since local time 00:00:00 Jan 1st 1970.
86 @see wxDateTime::Now()
88 @header{wx/stopwatch.h}
90 long wxGetLocalTime();
93 Returns the number of milliseconds since local time 00:00:00 Jan 1st 1970.
95 @see wxDateTime::Now(), wxLongLong
97 @header{wx/stopwatch.h}
99 wxLongLong
wxGetLocalTimeMillis();
102 Returns the number of seconds since GMT 00:00:00 Jan 1st 1970.
104 @see wxDateTime::Now()
106 @header{wx/stopwatch.h}