Template Class DeltaTime

Class Documentation

template<typename ClockType = std::chrono::steady_clock>
class DeltaTime

Public Types

using TimePoint = typename ClockType::time_point
using Duration = typename ClockType::duration

Public Functions

inline DeltaTime()

Starts the first timing interval at construction.

inline double operator()()

Returns the elapsed interval in seconds and begins the next interval at the same sampled time.

inline Duration elapsed() const

Declaration: [[nodiscard]]

Returns the duration since the most recent check-in without beginning a new interval.

inline void checkin()

Ends the current interval and begins a new one at the current time.

Protected Functions

inline Duration elapsed(const TimePoint now) const

Declaration: [[nodiscard]]

inline void checkin(const TimePoint now)