EtcPal
HEAD (unstable)
ETC Platform Abstraction Layer (EtcPal)
|
View other versions:
|
A wrapper class for the EtcPal timer type.
See the description for timer (Timers) for details about the time points and intervals used by this class.
Use this class to time an interval.
Public Member Functions | |
Timer ()=default | |
Creates an expired timer with an interval of 0. | |
constexpr | Timer (const EtcPalTimer &c_timer) noexcept |
Construct a timer copied from an instance of the C EtcPalTimer type. | |
Timer & | operator= (const EtcPalTimer &c_timer) noexcept |
Assign an instance of the C EtcPalTimer type to an instance of this class. | |
Timer (uint32_t interval) noexcept | |
Create and start a timer with the given interval in milliseconds. | |
template<typename Rep , typename Period > | |
Timer (const std::chrono::duration< Rep, Period > &interval) noexcept | |
Create and start a timer with the given interval. More... | |
constexpr const EtcPalTimer & | get () const noexcept |
Get a const reference to the underlying C type. | |
ETCPAL_CONSTEXPR_14 EtcPalTimer & | get () noexcept |
Get a mutable reference to the underlying C type. | |
TimePoint | GetStartTime () const noexcept |
Get the time when this timer was started or reset. | |
uint32_t | GetInterval () const noexcept |
Get the current interval being timed by the timer. | |
uint32_t | GetElapsed () const noexcept |
Get the time since the timer was reset. | |
uint32_t | GetRemaining () const noexcept |
Get the amount of time remaining in the timer's interval (returns 0 if the timer is expired). | |
bool | IsExpired () const noexcept |
Whether the timer's interval is expired. | |
void | Start (uint32_t interval) noexcept |
Start the timer with a new interval. More... | |
template<typename Rep , typename Period > | |
void | Start (const std::chrono::duration< Rep, Period > &interval) noexcept |
Start the timer with a new interval. More... | |
void | Reset () noexcept |
Reset the timer while keeping the same interval. | |
|
explicitnoexcept |
Create and start a timer with the given interval.
Note: interval will be clamped to [0, UINT32_MAX] milliseconds.
|
noexcept |
Start the timer with a new interval.
interval | Interval to time. Will be clamped to [0, UINT32_MAX] milliseconds. An interval of 0 will result in a timer that is always expired. |
|
inlinenoexcept |
Start the timer with a new interval.
interval | Interval to time, in milliseconds. An interval of 0 will result in a timer that is always expired. |