Struct Timer¶
Defined in File timer.hpp
Struct Documentation¶
-
struct
ripple
::
Timer
¶ The Timer struct is a simple class which starts on construction, and stops with a call to elapsed.
The timer is also resettable.
Public Types
-
using
Clock
= std::chrono::high_resolution_clock¶ Defines the type of the clock.
-
using
Duration
= std::chrono::duration<double>¶ Defines the type of the duration.
Public Functions
-
Timer
() noexcept¶ Constructor which starts the timer.
-
auto
reset
() noexcept -> void¶ Resets the timer by restarting the clock.
-
auto
elapsed
(bool reset_timer = false) noexcept -> double¶ Gets the elapsed time since the start of the clock, in micro seconds.
- Return
The number of microseconds since the timer was started.
- Parameters
reset_timer
: If the timer must be reset.
-
auto
elapsed_msec
(bool reset_timer = false) noexcept -> double¶ Gets the number of elapsed milliseconds since the start of the timer, and optionally resets the timer.
- Return
The number of milliseconds since the timer started.
- Parameters
reset_timer
: If the timer must be reset.
Public Static Attributes
-
constexpr double
microsecs_to_millisecs
= 1000.0¶ Convesion factor from micro to milliseconds.
-
using