]> git.saurik.com Git - wxWidgets.git/blame - interface/stopwatch.h
remove wxTextAttr::CreateFont(); return wxNullFont from GetFont() if we have no font...
[wxWidgets.git] / interface / stopwatch.h
CommitLineData
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 34class wxStopWatch
23324ae1
FM
35{
36public:
37 /**
38 Constructor. This starts the stop watch.
39 */
40 wxStopWatch();
41
42 /**
7c913512 43 Pauses the stop watch. Call Resume() to resume
23324ae1 44 time measuring again.
23324ae1 45 If this method is called several times, @c Resume() must be called the same
7c913512 46 number of times to really resume the stop watch. You may, however, call
23324ae1
FM
47 Start() to resume it unconditionally.
48 */
49 void Pause();
50
51 /**
7c913512 52 Resumes the stop watch which had been paused with
23324ae1
FM
53 Pause().
54 */
55 void Resume();
56
57 /**
58 (Re)starts the stop watch with a given initial value.
59 */
60 void Start(long milliseconds = 0);
61
62 /**
63 Returns the time in milliseconds since the start (or restart) or the last call
7c913512 64 of
23324ae1
FM
65 Pause().
66 */
67 long Time();
68};
69
70
71// ============================================================================
72// Global functions/macros
73// ============================================================================
74
75/**
76 Returns the number of seconds since local time 00:00:00 Jan 1st 1970.
7c913512 77
4cc4bfaf 78 @see wxDateTime::Now
23324ae1
FM
79*/
80long wxGetLocalTime();
81
82/**
83 Returns the number of seconds since GMT 00:00:00 Jan 1st 1970.
7c913512 84
4cc4bfaf 85 @see wxDateTime::Now
23324ae1
FM
86*/
87long wxGetUTCTime();
88
89/**
90 Returns the number of milliseconds since local time 00:00:00 Jan 1st 1970.
7c913512 91
4cc4bfaf 92 @see wxDateTime::Now, wxLongLong
23324ae1
FM
93*/
94wxLongLong wxGetLocalTimeMillis();
95