]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/stopwatch.h
Further corrections to wxFileName docs
[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. For example, you may
13 use it to measure the time elapsed by some function:
14
15 @code
16 wxStopWatch sw;
17 CallLongRunningFunction();
18 wxLogMessage("The long running function took %ldms to execute",
19 sw.Time());
20 sw.Pause();
21 ... stopwatch is stopped now ...
22 sw.Resume();
23 CallLongRunningFunction();
24 wxLogMessage("And calling it twice took $ldms in all", sw.Time());
25 @endcode
26
27 @library{wxbase}
28 @category{misc}
29
30 @see wxTimer
31 */
32 class wxStopWatch
33 {
34 public:
35 /**
36 Constructor. This starts the stop watch.
37 */
38 wxStopWatch();
39
40 /**
41 Pauses the stop watch. Call Resume() to resume
42 time measuring again.
43 If this method is called several times, @c Resume() must be called the same
44 number of times to really resume the stop watch. You may, however, call
45 Start() to resume it unconditionally.
46 */
47 void Pause();
48
49 /**
50 Resumes the stop watch which had been paused with
51 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 call
62 of
63 Pause().
64 */
65 long Time() const;
66 };
67
68
69
70 // ============================================================================
71 // Global functions/macros
72 // ============================================================================
73
74 /** @ingroup group_funcmacro_time */
75 //@{
76
77 /**
78 Returns the number of seconds since local time 00:00:00 Jan 1st 1970.
79
80 @see wxDateTime::Now()
81
82 @header{wx/stopwatch.h}
83 */
84 long wxGetLocalTime();
85
86 /**
87 Returns the number of milliseconds since local time 00:00:00 Jan 1st 1970.
88
89 @see wxDateTime::Now(), wxLongLong
90
91 @header{wx/stopwatch.h}
92 */
93 wxLongLong wxGetLocalTimeMillis();
94
95 /**
96 Returns the number of seconds since GMT 00:00:00 Jan 1st 1970.
97
98 @see wxDateTime::Now()
99
100 @header{wx/stopwatch.h}
101 */
102 long wxGetUTCTime();
103
104 //@}
105