]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: stopwatch.h | |
3 | // Purpose: documentation for wxStopWatch class | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxStopWatch | |
11 | @wxheader{stopwatch.h} | |
12 | ||
13 | The wxStopWatch class allow you to measure time intervals. For example, you may | |
14 | 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 | @seealso | |
32 | wxTimer | |
33 | */ | |
34 | class wxStopWatch | |
35 | { | |
36 | public: | |
37 | /** | |
38 | Constructor. This starts the stop watch. | |
39 | */ | |
40 | wxStopWatch(); | |
41 | ||
42 | /** | |
43 | Pauses the stop watch. Call Resume() to resume | |
44 | time measuring again. | |
45 | ||
46 | If this method is called several times, @c Resume() must be called the same | |
47 | number of times to really resume the stop watch. You may, however, call | |
48 | Start() to resume it unconditionally. | |
49 | */ | |
50 | void Pause(); | |
51 | ||
52 | /** | |
53 | Resumes the stop watch which had been paused with | |
54 | Pause(). | |
55 | */ | |
56 | void Resume(); | |
57 | ||
58 | /** | |
59 | (Re)starts the stop watch with a given initial value. | |
60 | */ | |
61 | void Start(long milliseconds = 0); | |
62 | ||
63 | /** | |
64 | Returns the time in milliseconds since the start (or restart) or the last call | |
65 | of | |
66 | Pause(). | |
67 | */ | |
68 | long Time(); | |
69 | }; | |
70 | ||
71 | ||
72 | // ============================================================================ | |
73 | // Global functions/macros | |
74 | // ============================================================================ | |
75 | ||
76 | /** | |
77 | Returns the number of seconds since local time 00:00:00 Jan 1st 1970. | |
78 | ||
79 | @sa wxDateTime::Now | |
80 | */ | |
81 | long wxGetLocalTime(); | |
82 | ||
83 | /** | |
84 | Returns the number of seconds since GMT 00:00:00 Jan 1st 1970. | |
85 | ||
86 | @sa wxDateTime::Now | |
87 | */ | |
88 | long wxGetUTCTime(); | |
89 | ||
90 | /** | |
91 | Returns the number of milliseconds since local time 00:00:00 Jan 1st 1970. | |
92 | ||
93 | @sa wxDateTime::Now, wxLongLong | |
94 | */ | |
95 | wxLongLong wxGetLocalTimeMillis(); | |
96 |