Floating point timer. More...
Public Member Functions | |
FloatTimer () noexcept | |
Constructor for the floating point timer. | |
float | GetLastTime (void) const noexcept |
Get the last read time. | |
uint_t | IsPaused (void) const noexcept |
Returns TRUE if the timer is paused. | |
void | Reset (void) noexcept |
Reset the timer. | |
float | GetTime (void) noexcept |
Read the timer in seconds. | |
void | Pause (void) noexcept |
Pause the timer. | |
void | Unpause (void) noexcept |
Unpause the timer. | |
Private Member Functions | |
void | SetBase (void) noexcept |
Reset the timer. | |
Private Attributes | |
double | m_dReciprocalFrequency |
1.0 / CPU timebase | |
uint64_t | m_uBaseTime |
Integer time mark of the last read time in high precision. | |
uint64_t | m_uElapsedTime |
Integer time mark of the elapsed time in high precision. | |
uint64_t | m_uBaseTimeNano |
Nanosecond time for time mark. | |
uint64_t | m_uElapsedTimeNano |
Nanosecond time for elapsed time. | |
uint32_t | m_uBaseTime |
Microsecond mark of the last read time. | |
float | m_fElapsedTime |
Last read time. | |
uint_t | m_bPaused |
TRUE if this timer is currently paused | |
Floating point timer.
Upon class start up, a high accuracy timer is read and this moment is considered 0.0f elapsed time. When the timer is queried, it will return a floating point number in seconds. 0.5f is a half second, etc...
The value is as high an accuracy as the platform supports.
|
noexcept |
Constructor for the floating point timer.
Reads in the default data needed to maintain the timer and sets the elapsed time to 0.0f
|
inlinenoexcept |
Get the last read time.
Returns the last time value without actually asking the platform for a time update.
Call GetTime(void) to read the timer and return a updating timer.
|
noexcept |
Read the timer in seconds.
Return the elapsed time in seconds from the last time this timer was reset. If the timer is paused, the value will be at the time mark when the pause was invoked.
|
inlinenoexcept |
Returns TRUE if the timer is paused.
If the timer was paused with a call to Pause(void), the timer will not increment. This function will return TRUE if the timer is in pause mode.
|
noexcept |
Pause the timer.
If the timer was not paused, accumulate the current time into the elapsed time and freeze the timer at that value.
If it was already paused, this function will do nothing.
|
noexcept |
|
privatenoexcept |
Reset the timer.
Set m_uBaseTime to the current high precision time, however this function will not reset the elapsed time.
|
noexcept |
Unpause the timer.
If the timer was paused, mark the current time as the moment timing will commence.
If it was not paused, this function will do nothing.
|
private |
1.0 / CPU timebase
|
private |
Last read time.
|
private |
Integer time mark of the last read time in high precision.
|
private |
Microsecond mark of the last read time.
|
private |
Nanosecond time for time mark.
|
private |
Integer time mark of the elapsed time in high precision.
|
private |
Nanosecond time for elapsed time.