An Instant represents a timestamp with respect to the currently executing program that ticks during suspend and can be used to record elapsed time unlike nanoTimestamp
.
It tries to sample the system’s fastest and most precise timer available. It also tries to be monotonic, but this is not a guarantee due to OS/hardware bugs. If you need monotonic readings for elapsed time, consider Timer
instead.
Functions
fn now() error{Unsupported}!Instant
Queries the system for the current moment of time as an Instant. This is not gu…
Queries the system for the current moment of time as an Instant. This is not guaranteed to be monotonic or steadily increasing, but for most implementations it is. Returns
error.Unsupported
when a suitable clock is not detected.fn order(self: Instant, other: Instant) std.math.Order
Quickly compares two instances between each other.
fn since(self: Instant, earlier: Instant) u64
Returns elapsed time in nanoseconds since the
earlier
Instant. This assumes t…Returns elapsed time in nanoseconds since the
earlier
Instant. This assumes that theearlier
Instant represents a moment in time before or equal toself
. This also assumes that the time that has passed between both Instants fits inside a u64 (~585 yrs).