#include <monotime.h>
Public Member Functions | |
MonotonicTime () | |
MonotonicTime class constructor Create an instance of the time class by taking a sample of MonotonicTime. | |
MonotonicTime (UINT32) | |
MonotonicTime class constructor Create an instance of the time class by setting it to the specified time. | |
UINT32 | Sample () |
Take a sample of "now" in monotonic time. | |
BOOL | Elapsed (UINT32) |
Test whether the given time interval has elapsed since the monotonic time was last sampled. | |
BOOL | Elapsed (UINT32, BOOL) |
Test whether the given time interval has elapsed since the monotonic time was last sampled. If the update flag is set then the sample time is reset to be the EXACT time when the interval was exceeded. This allows the interval to be regular and accurate in the long-term even though individual intervals will be subject to timing and sampling innaccuracies. | |
operator UINT32 () | |
Cast operator that allows comparisons of MonotonicTime objects to be made. | |
Static Public Member Functions | |
static void | Init () |
MonotonicTime initialiser. | |
Private Attributes | |
UINT32 | SampleTime |
Static Private Attributes | |
static wxStopWatch | s_stopwatch |
Definition at line 131 of file monotime.h.
|
MonotonicTime class constructor Create an instance of the time class by taking a sample of MonotonicTime.
Definition at line 164 of file monotime.cpp. 00165 { 00166 Sample(); 00167 }
|
|
MonotonicTime class constructor Create an instance of the time class by setting it to the specified time.
Definition at line 192 of file monotime.cpp. 00193 { 00194 SampleTime = initialiser; 00195 }
|
|
Test whether the given time interval has elapsed since the monotonic time was last sampled. If the update flag is set then the sample time is reset to be the EXACT time when the interval was exceeded. This allows the interval to be regular and accurate in the long-term even though individual intervals will be subject to timing and sampling innaccuracies.
Definition at line 297 of file monotime.cpp. 00298 { 00299 if ( Elapsed( interval ) ) 00300 { 00301 //#if defined(__WXGTK__) 00302 // interval = interval * CLOCKS_PER_SEC / 1000; 00303 //#endif 00304 00305 if ( update ) 00306 SampleTime += interval; 00307 00308 return TRUE; 00309 } 00310 return FALSE; 00311 }
|
|
Test whether the given time interval has elapsed since the monotonic time was last sampled.
Definition at line 258 of file monotime.cpp. 00259 { 00260 #if defined(__WXMSW__) 00261 return ( ( SampleTime + interval ) < GetTickCount() ); 00262 #elif defined(__WXGTK__) || defined(__WXMAC__) 00263 // return( ( SampleTime + ( interval * CLOCKS_PER_SEC / 1000 ) ) < (UINT32)clock() ); 00264 // return ( ( SampleTime + interval ) < GetPosixTickCount() ); 00265 return ((SampleTime +interval) < (UINT32)s_stopwatch.Time()); 00266 #else 00267 #pragma error( "Not impl'ed from this architechure" ); 00268 #endif 00269 }
|
|
MonotonicTime initialiser.
Definition at line 135 of file monotime.cpp. 00136 { 00137 s_stopwatch.Start(); 00138 }
|
|
Cast operator that allows comparisons of MonotonicTime objects to be made.
Definition at line 327 of file monotime.cpp. 00328 { 00329 return SampleTime; 00330 }
|
|
Take a sample of "now" in monotonic time.
Definition at line 220 of file monotime.cpp. 00221 { 00222 #if defined(__WXMSW__) 00223 SampleTime = GetTickCount(); 00224 #elif defined(__WXGTK__) || defined(__WXMAC__) 00225 // SampleTime = count(); 00226 // SampleTime = GetPosixTickCount(); 00227 SampleTime = s_stopwatch.Time(); 00228 #else 00229 #pragma error( "Not impl'ed from this architechure" ); 00230 #endif 00231 00232 return SampleTime; 00233 }
|
|
Definition at line 149 of file monotime.h. |
|
Definition at line 147 of file monotime.h. |