Template Class DeltaTime
Defined in File delta.h
Class Documentation
-
template<typename ClockType = std::chrono::steady_clock>
class DeltaTime Caller-owned interval timer, without synchronization.
See also
- Template Parameters:
ClockType – Clock providing now(), time_point and duration; defaults to steady_clock. The clock determines tick representation and backward-jump behavior. No fixed timestep, smoothing, clamping or scheduling policy is added.
Public Types
Public Functions
-
inline DeltaTime()
Begins the first interval at one ClockType::now() sample.
Clock failures, if any, propagate; construction does not sleep or start a thread.
-
inline double operator()()
Returns elapsed seconds and begins the next interval at the same sampled instant.
- Returns:
Floating seconds since the previous check-in; a custom clock may yield negative values. Samples the clock once; repeated calls measure successive intervals. No synchronization is added.
-
inline Duration elapsed() const
Declaration:
[[nodiscard]]Reads the native duration without starting a new interval.
- Returns:
Clock duration since the previous check-in, not necessarily whole seconds. The next read still measures from the same check-in.
-
inline void checkin()
Starts a new interval at the current clock sample.
Discards the unread elapsed interval; clock failures propagate before assignment.
Protected Functions
-
inline Duration elapsed(const TimePoint now) const
Declaration:
[[nodiscard]]Computes a duration using a caller-supplied time point.
- Parameters:
now – Sample in ClockType’s time domain; no clock read or state update occurs.
- Returns:
now minus the previous check-in; no range/backward-jump validation.