15 unsigned int timeout_goal;
28 timeout(
unsigned int timeout_micros = -1,
bool run =
true) noexcept;
48#if __has_include(<cereal/cereal.hpp>)
53 template <
class Archive>
54 void save(Archive &ar)
const {
56 int goal = timeout_goal;
57 ar(CEREAL_NVP(elapsed));
65 template <
class Archive>
66 void load(Archive &ar) {
69 ar(CEREAL_NVP(elapsed));
71 reset(std::chrono::high_resolution_clock::now() - std::chrono::microseconds(elapsed));
timeout(unsigned int timeout_micros=-1, bool run=true) noexcept
Timeout constructor.
bool timedOut() const noexcept
Check whether the timer has timed out.
void setTimeOut(unsigned int timeout_micros) noexcept
Set the time out goal.
void reset() noexcept
Reset the timer.
timer(bool run=true) noexcept
Timer constructor.
unsigned int micros() const noexcept
Get the elapsed time in microseconds.
Section containing core functions and classes.