]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/stopwatch.h
document recently added enums
[wxWidgets.git] / interface / wx / stopwatch.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: stopwatch.h
3 // Purpose: interface of wxStopWatch
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxStopWatch
11
12 The wxStopWatch class allow you to measure time intervals.
13
14 For example, you may use it to measure the time elapsed by some function:
15
16 @code
17 wxStopWatch sw;
18 CallLongRunningFunction();
19 wxLogMessage("The long running function took %ldms to execute",
20 sw.Time());
21 sw.Pause();
22 ... stopwatch is stopped now ...
23 sw.Resume();
24 CallLongRunningFunction();
25 wxLogMessage("And calling it twice took $ldms in all", sw.Time());
26 @endcode
27
28 @library{wxbase}
29 @category{misc}
30
31 @see wxTimer
32 */
33 class wxStopWatch
34 {
35 public:
36 /**
37 Constructor. This starts the stop watch.
38 */
39 wxStopWatch();
40
41 /**
42 Pauses the stop watch. Call Resume() to resume time measuring again.
43
44 If this method is called several times, @c Resume() must be called the same
45 number of times to really resume the stop watch. You may, however, call
46 Start() to resume it unconditionally.
47 */
48 void Pause();
49
50 /**
51 Resumes the stop watch which had been paused with Pause().
52 */
53 void Resume();
54
55 /**
56 (Re)starts the stop watch with a given initial value.
57 */
58 void Start(long milliseconds = 0);
59
60 /**
61 Returns the time in milliseconds since the start (or restart) or the last
62 call of Pause().
63 */
64 long Time() const;
65 };
66
67
68
69 // ============================================================================
70 // Global functions/macros
71 // ============================================================================
72
73 /** @addtogroup group_funcmacro_time */
74 //@{
75
76 /**
77 Returns the number of seconds since local time 00:00:00 Jan 1st 1970.
78
79 @see wxDateTime::Now()
80
81 @header{wx/stopwatch.h}
82 */
83 long wxGetLocalTime();
84
85 /**
86 Returns the number of milliseconds since local time 00:00:00 Jan 1st 1970.
87
88 @see wxDateTime::Now(), wxLongLong
89
90 @header{wx/stopwatch.h}
91 */
92 wxLongLong wxGetLocalTimeMillis();
93
94 /**
95 Returns the number of seconds since GMT 00:00:00 Jan 1st 1970.
96
97 @see wxDateTime::Now()
98
99 @header{wx/stopwatch.h}
100 */
101 long wxGetUTCTime();
102
103 //@}
104