Chrono

class Chrono(autoUpdate: Boolean = true, source: TimeSource = TimeSource.Monotonic, units: DurationUnit = DurationUnit.SECONDS)

A utility class for measuring elapsed time. This class provides functionality to track time intervals and optionally updates the elapsed time automatically on each access.

Constructors

Link copied to clipboard
constructor(autoUpdate: Boolean = true, source: TimeSource = TimeSource.Monotonic, units: DurationUnit = DurationUnit.SECONDS)

Properties

Link copied to clipboard
val dt: Double

Returns the delta time. Updates automatically if autoUpdate is true.

Functions

Link copied to clipboard
fun peek(): Double

Check elapsed time without advancing the mark.

Link copied to clipboard
fun reset()

Reset the reference mark to now.

Link copied to clipboard
fun update(): Double

Compute elapsed time since last update and refresh the reference.