Skip to content

Engine → Core

clock.h

A monotonic time source measured in seconds. The epoch is implementation defined: only differences between two readings of the same clock are meaningful.

Classes

File Description
clock A monotonic time source measured in seconds. The epoch is implementation defined: only differences between two readings of the same clock are meaningful.
manual_clock A clock that only moves when told to. Starts at zero. Used by tests and by tools that step the engine deterministically.
steady_clock Real time from std::chrono::steady_clock. Seconds count from the first use of any steady_clock in the process, so readings start near zero and keep full double precision. Every instance reads the same underlying time.
stopwatch Measures elapsed time on a clock. Runs from construction; start() and restart() reset the origin. The clock is referenced, not owned, and must outlive the stopwatch.

Functions

Public

default_clock

[[nodiscard]] CONJURE_API clock &default_clock() noexcept;

The process-wide steady clock. Use it when no clock was injected.

ticks_now

[[nodiscard]] CONJURE_API u64 ticks_now() noexcept;

Raw steady-clock ticks for profiling. Convert differences with ticks_to_seconds.

ticks_per_second

[[nodiscard]] CONJURE_API u64 ticks_per_second() noexcept;

Number of ticks in one second of the steady clock.

ticks_to_seconds

[[nodiscard]] CONJURE_API f64 ticks_to_seconds(
    u64 ticks) noexcept;

Converts a tick count (or a difference of two) from ticks_now into seconds.