std/time
Types
Instant
pub type Instant = {
// private fields omitted
}
A point in time taken from the system clock.
Instant.unixMillis
pub pure noalloc fn Instant.unixMillis(self) -> i64
Milliseconds since 1970-01-01T00:00:00Z.
Instant.utc
pub pure fn Instant.utc(self) -> String
The instant in UTC as RFC 3339 text with seconds, e.g. 2026-09-06T01:02:03Z.
Instant.elapsedMillis
pub fn Instant.elapsedMillis(self) -> i64
Milliseconds elapsed since this instant was taken.
Monotonic
pub type Monotonic = {
// private fields omitted
}
A reading from a clock that only ever moves forward, unaffected by clock adjustments (e.g. NTP). Unlike Instant, it carries no wall-clock meaning; use it for ticks, timeouts and animation frame timing.
Monotonic.diffMillis
pub pure noalloc fn Monotonic.diffMillis(self, earlier: Monotonic) -> i64
Milliseconds between two monotonic readings (self minus earlier).
Monotonic.elapsedMillis
pub fn Monotonic.elapsedMillis(self) -> i64
Milliseconds elapsed since this reading was taken.
Functions
fromUnixMillis
pub pure fn fromUnixMillis(ms: i64) -> Instant
The instant ms milliseconds after 1970-01-01T00:00:00Z.
now
pub fn now() -> Instant
The current time.
monotonic
pub fn monotonic() -> Monotonic
The current reading of the monotonic clock (CLOCK_MONOTONIC).
sleep
pub fn sleep(millis: i64)
Pauses the current thread for millis milliseconds.