Enhanced C#
Language of your choice: library documentation
|
A fast, simple timer class with a more convenient interface than System.Diagnostics.Stopwatch. Its resolution is typically 10-16 ms on desktop Windows systems. More...
A fast, simple timer class with a more convenient interface than System.Diagnostics.Stopwatch. Its resolution is typically 10-16 ms on desktop Windows systems.
With SimpleTimer, the timer starts when you construct the object and it is always counting. You can get the elapsed time and restart the timer from zero with a single call to Restart(). The Stopwatch class requires you to make three separate method calls to do the same thing: you have to call ElapsedMilliseconds, then Reset(), then Start().
SimpleTimer cannot be used to measure time periods longer than 24.8 days. The 32-bit millisecond counter will overflow and Millisec will become negative.
Properties | |
int | Millisec [get, set] |
The getter returns the number of milliseconds since the timer was started; the resolution of this property depends on the system timer. The setter changes the value of the timer. More... | |
bool | Paused [get] |
Public Member Functions | |
int | Restart () |
Restarts the timer from zero (unpausing it if it is paused), and returns the number of elapsed milliseconds prior to the reset. More... | |
bool | Pause () |
bool | Resume () |
int | ClearAfter (int minimumMillisec) |
Restarts the timer from zero if the specified number of milliseconds have passed, and returns the former value of Millisec. More... | |
|
inline |
Restarts the timer from zero if the specified number of milliseconds have passed, and returns the former value of Millisec.
If this method resets a paused timer, it remains paused but Millisec is set to zero.
|
inline |
Restarts the timer from zero (unpausing it if it is paused), and returns the number of elapsed milliseconds prior to the reset.
|
getset |
The getter returns the number of milliseconds since the timer was started; the resolution of this property depends on the system timer. The setter changes the value of the timer.