|
BoosterSeat
0.1
A C++ library that includes common utilities that are used in other projects.
|
A simple timer class for timing events. More...
#include <timer.hpp>
Public Member Functions | |
| Timer () | |
| Create a new timer with a timeout of 0. Must call setTimeout before using. More... | |
| Timer (int timeout_ms) | |
| Create a new timer with a timeout. More... | |
| bool | isDone () const override |
| Check if the timer has expired. More... | |
| void | reset () override |
| Reset the timer to the current time. More... | |
| void | setDone () override |
| Set the timer to be done. Changes the start time. More... | |
| void | setTimeout (int timeout_ms) override |
| Set the timeout of the timer. More... | |
Private Attributes | |
| bst::clck::TimePoint | start_ = bst::clck::Clock::now() |
| int | timeout_ms_ |
A simple timer class for timing events.
| bst::Timer::Timer | ( | int | timeout_ms | ) |
Create a new timer with a timeout.
| timeout_ms | The timeout in milliseconds |
| bst::Timer::Timer | ( | ) |
Create a new timer with a timeout of 0. Must call setTimeout before using.
|
overridevirtual |
Reset the timer to the current time.
Implements bst::ITimer.
References bst::clck::now(), and start_.
Referenced by main(), and TEST().
|
overridevirtual |
Check if the timer has expired.
Implements bst::ITimer.
References bst::clck::now(), start_, and timeout_ms_.
Referenced by main(), and TEST().
|
overridevirtual |
Set the timeout of the timer.
| timeout_ms | The timeout in milliseconds |
Implements bst::ITimer.
References timeout_ms_.
Referenced by TEST().
|
overridevirtual |
Set the timer to be done. Changes the start time.
Implements bst::ITimer.
References bst::clck::now(), start_, and timeout_ms_.
|
private |
|
private |
Referenced by isDone(), setDone(), and setTimeout().