This class implements a high precision clock.
More...
#include <CPrecisionClock.h>
cPrecisionClock implements a high-precision clock. All measurements are computed in seconds unless otherwise-specified.
cPrecisionClock behaves just like a real chronograph: It can be started, stopped and restarted at a later time. When a clock is running (ON), time is accumulated until the next stop event (OFF). The value of a clock can be read by calling method getCurrentTimeSeconds(). When a clock is disabled (OFF), time is no longer accumulated.
chai3d::cPrecisionClock::cPrecisionClock |
( |
| ) |
|
virtual chai3d::cPrecisionClock::~cPrecisionClock |
( |
| ) |
|
|
inlinevirtual |
void chai3d::cPrecisionClock::reset |
( |
const double |
a_currentTime = 0.0 | ) |
|
This method resets clock with an initial time value in seconds. (Default value is 0 seconds).
- Parameters
-
a_currentTime | Time in seconds to initialize clock. |
double chai3d::cPrecisionClock::start |
( |
bool |
a_resetClock = false | ) |
|
This method starts or restarts the clock. To read the clock time, call method getCurrentTimeSeconds().
- Parameters
-
a_resetClock | If true clock is initialized, otherwise resume counting. |
- Returns
- Current clock time in seconds.
double chai3d::cPrecisionClock::stop |
( |
| ) |
|
This method stops the clock and returns elapsed time. To resume counting call method start().
- Returns
- Time in seconds.
bool chai3d::cPrecisionClock::on |
( |
| ) |
const |
|
inline |
double chai3d::cPrecisionClock::getCurrentTimeSeconds |
( |
| ) |
const |
This method returns the current time of clock in seconds.
- Returns
- Current time in seconds.
void chai3d::cPrecisionClock::setTimeoutPeriodSeconds |
( |
const double |
a_timeoutPeriod | ) |
|
This method sets the period in seconds before timeout occurs. Do not forget to enable the timer ON by calling method start(). Monitoring for timeout is performed by calling timeoutOccurred().
- Parameters
-
a_timeoutPeriod | Timeout period in seconds. |
double chai3d::cPrecisionClock::getTimeoutPeriodSeconds |
( |
| ) |
const |
|
inline |
bool chai3d::cPrecisionClock::timeoutOccurred |
( |
| ) |
const |
This method check if the clock has expired its timeout period.
- Returns
- true if timeout occurred, otherwise false.
bool chai3d::cPrecisionClock::highResolution |
( |
| ) |
const |
|
inline |
double chai3d::cPrecisionClock::getCPUTimeSeconds |
( |
| ) |
|
|
static |
This method returns the raw CPU time in seconds.
- Returns
- Raw CPU clock time in seconds.
void chai3d::cPrecisionClock::initialize |
( |
| ) |
|
|
staticprotected |
LARGE_INTEGER chai3d::cPrecisionClock::m_freq |
|
staticprotected |
bool chai3d::cPrecisionClock::m_highres = false |
|
staticprotected |
bool chai3d::cPrecisionClock::m_initialized = false |
|
staticprotected |
double chai3d::cPrecisionClock::m_timeAccumulated |
|
protected |
double chai3d::cPrecisionClock::m_timeStart |
|
protected |
double chai3d::cPrecisionClock::m_timeoutPeriod |
|
protected |
double chai3d::cPrecisionClock::m_timeoutStart |
|
protected |
bool chai3d::cPrecisionClock::m_on |
|
protected |
The documentation for this class was generated from the following files: