Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::FloatTimer Class Reference

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
 

Detailed Description

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.

See also
GetTime(void) or Tick

Constructor & Destructor Documentation

◆ FloatTimer()

Burger::FloatTimer::FloatTimer ( )
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

See also
GetTime(void) or Reset(void)

Member Function Documentation

◆ GetLastTime()

float Burger::FloatTimer::GetLastTime ( void ) const
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.

Returns
Elapsed time in seconds
See also
GetTime(void) or Reset(void)

◆ GetTime()

float BURGER_API Burger::FloatTimer::GetTime ( void )
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.

See also
Pause(void) or Reset(void)

◆ IsPaused()

uint_t Burger::FloatTimer::IsPaused ( void ) const
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.

Returns
FALSE if the timer is running, TRUE if paused
See also
Pause(void) or Unpause(void)

◆ Pause()

void BURGER_API Burger::FloatTimer::Pause ( void )
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.

See also
Unpause(void)

◆ Reset()

void BURGER_API Burger::FloatTimer::Reset ( void )
noexcept

Reset the timer.


Clear the timer to 0.0f.

See also
GetTime(void)

◆ SetBase()

void BURGER_API Burger::FloatTimer::SetBase ( void )
privatenoexcept

Reset the timer.


Set m_uBaseTime to the current high precision time, however this function will not reset the elapsed time.

See also
Reset(void)

◆ Unpause()

void BURGER_API Burger::FloatTimer::Unpause ( void )
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.

See also
Pause(void)

Member Data Documentation

◆ m_bPaused

uint_t Burger::FloatTimer::m_bPaused
private

TRUE if this timer is currently paused

◆ m_dReciprocalFrequency

double Burger::FloatTimer::m_dReciprocalFrequency
private

1.0 / CPU timebase

◆ m_fElapsedTime

float Burger::FloatTimer::m_fElapsedTime
private

Last read time.

◆ m_uBaseTime [1/2]

uint64_t Burger::FloatTimer::m_uBaseTime
private

Integer time mark of the last read time in high precision.

◆ m_uBaseTime [2/2]

uint32_t Burger::FloatTimer::m_uBaseTime
private

Microsecond mark of the last read time.

◆ m_uBaseTimeNano

uint64_t Burger::FloatTimer::m_uBaseTimeNano
private

Nanosecond time for time mark.

◆ m_uElapsedTime

uint64_t Burger::FloatTimer::m_uElapsedTime
private

Integer time mark of the elapsed time in high precision.

◆ m_uElapsedTimeNano

uint64_t Burger::FloatTimer::m_uElapsedTimeNano
private

Nanosecond time for elapsed time.