]>
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} | |
7c913512 | 12 | |
23324ae1 FM |
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: | |
7c913512 | 15 | |
23324ae1 FM |
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 | |
7c913512 | 27 | |
23324ae1 FM |
28 | @library{wxbase} |
29 | @category{misc} | |
7c913512 | 30 | |
23324ae1 FM |
31 | @seealso |
32 | wxTimer | |
33 | */ | |
7c913512 | 34 | class wxStopWatch |
23324ae1 FM |
35 | { |
36 | public: | |
37 | /** | |
38 | Constructor. This starts the stop watch. | |
39 | */ | |
40 | wxStopWatch(); | |
41 | ||
42 | /** | |
7c913512 | 43 | Pauses the stop watch. Call Resume() to resume |
23324ae1 FM |
44 | time measuring again. |
45 | ||
46 | If this method is called several times, @c Resume() must be called the same | |
7c913512 | 47 | number of times to really resume the stop watch. You may, however, call |
23324ae1 FM |
48 | Start() to resume it unconditionally. |
49 | */ | |
50 | void Pause(); | |
51 | ||
52 | /** | |
7c913512 | 53 | Resumes the stop watch which had been paused with |
23324ae1 FM |
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 | |
7c913512 | 65 | of |
23324ae1 FM |
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. | |
7c913512 | 78 | |
23324ae1 FM |
79 | @sa wxDateTime::Now |
80 | */ | |
81 | long wxGetLocalTime(); | |
82 | ||
83 | /** | |
84 | Returns the number of seconds since GMT 00:00:00 Jan 1st 1970. | |
7c913512 | 85 | |
23324ae1 FM |
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. | |
7c913512 | 92 | |
23324ae1 FM |
93 | @sa wxDateTime::Now, wxLongLong |
94 | */ | |
95 | wxLongLong wxGetLocalTimeMillis(); | |
96 |