Instant
Owns monotonic ticks and their private compatible clock domain.
Module std.time
import std.time;Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.
Instant
pub struct InstantOwns monotonic ticks and their private compatible clock domain.
Default is invalid rather than pretending to be a sampled clock origin. Only native sampling or checked displacement creates a usable value. Domain and ticks own no runtime handle and do not expire with a local variable. Values may be copied across threads in this process; no cross-process domain interchange is promised. No Unix timestamp conversion exists. Immutable use allocates nothing and needs no synchronization. Sampling is runtime work.
Instant.IsValid
pub IsValid: bool;Reports whether a clock domain has been established. Return: True for a sampled/derived domain.
Instant.TryNow
pub static fn TryNow() -> Result<Instant, TimeError>Samples the native monotonic clock. Return: Owned instant or checked sampling/range error.
Instant.Now
pub static fn Now() -> InstantSamples monotonic time, trapping only a checked sampling failure. Return: Owned valid instant; use TryNow for recovery.
Instant.TryAdd
pub readonly fn TryAdd<Rep, const Numerator: u64, const Denominator: u64>(Delta: readonly Duration<Rep, Numerator, Denominator>&) -> Result<Instant, TimeError> where Rep: Data, DurationCountAdds exact displacement while retaining the monotonic domain. Rep: Copyable Defaultable numeric count. Numerator: Positive rational seconds numerator. Denominator: Positive rational seconds denominator. Delta: Borrowed finite displacement; negative values are allowed. Return: New instant or invalid-domain/conversion/range error; no sampling occurs.
Instant.TrySubtract
pub readonly fn TrySubtract<Rep, const Numerator: u64, const Denominator: u64>(Delta: readonly Duration<Rep, Numerator, Denominator>&) -> Result<Instant, TimeError> where Rep: Data, DurationCountSubtracts exact displacement while retaining the monotonic domain. Rep: Copyable Defaultable numeric count. Numerator: Positive rational seconds numerator. Denominator: Positive rational seconds denominator. Delta: Borrowed finite displacement; negative values are allowed. Return: New instant or invalid-domain/conversion/range error; no sampling occurs.
Instant.TryDifference
pub readonly fn TryDifference(Other: readonly Instant&) -> Result<Duration<i128, 1, 1000000000>, TimeError>Computes exact elapsed nanoseconds in a compatible monotonic domain. Other: Borrowed instant, valid in the same domain. Return: Signed duration or domain/range error; no clock is sampled.
Instant.TryCompare
pub readonly fn TryCompare(Other: readonly Instant&) -> Result<i32, TimeError>Compares compatible monotonic instants without subtraction overflow. Other: Borrowed instant in the same valid domain. Return: Signed ordering or IncompatibleClockDomain; no sampling occurs.
Instant.operator
pub readonly fn operator +<Rep, const Numerator: u64, const Denominator: u64>(Delta: readonly Duration<Rep, Numerator, Denominator>&) -> Instant where Rep: Data, DurationCountAdds exact displacement with checked-failure trapping. Rep: Copyable Defaultable count. Numerator: Positive rational seconds numerator. Denominator: Positive rational seconds denominator. Delta: Borrowed displacement. Return: Derived instant; use TryAdd for recoverable errors.
Instant.operator
pub readonly fn operator -(Other: readonly Instant&) -> Duration<i128, 1, 1000000000>Subtracts compatible instants with checked-failure trapping. Other: Borrowed instant in the same domain. Return: Signed elapsed duration; use TryDifference for recovery.
Instant.operator
pub readonly fn operator -<Rep, const Numerator: u64, const Denominator: u64>(Delta: readonly Duration<Rep, Numerator, Denominator>&) -> Instant where Rep: Data, DurationCountSubtracts exact displacement without negating a signed minimum. Rep: Copyable Defaultable count. Numerator: Positive rational seconds numerator. Denominator: Positive rational seconds denominator. Delta: Borrowed displacement. Return: Derived instant; use TrySubtract for recoverable errors.
Instant.operator
pub readonly fn operator == (Other: readonly Instant&) -> boolCompares compatible monotonic values, trapping a domain error. Other: Borrowed compatible instant. Return: Whether chronological == holds; use TryCompare for recovery.
Instant.operator
pub readonly fn operator < (Other: readonly Instant&) -> boolCompares compatible monotonic values, trapping a domain error. Other: Borrowed compatible instant. Return: Whether chronological < holds; use TryCompare for recovery.
Instant.operator
pub readonly fn operator <= (Other: readonly Instant&) -> boolCompares compatible monotonic values, trapping a domain error. Other: Borrowed compatible instant. Return: Whether chronological <= holds; use TryCompare for recovery.
Instant.operator
pub readonly fn operator > (Other: readonly Instant&) -> boolCompares compatible monotonic values, trapping a domain error. Other: Borrowed compatible instant. Return: Whether chronological > holds; use TryCompare for recovery.
Instant.operator
pub readonly fn operator >= (Other: readonly Instant&) -> boolCompares compatible monotonic values, trapping a domain error. Other: Borrowed compatible instant. Return: Whether chronological >= holds; use TryCompare for recovery.