← index

Instant

inherits Object

A point on the monotonic clock, for measuring elapsed time.

Monotonic means forward-only and immune to wall-clock adjustments (NTP steps, manual changes), which makes an Instant the right tool for timing and the wrong one for calendars — it has no date, cannot be serialized, and is only meaningful within the current process. For wall-clock time use Timestamp; for zone-aware dates use DateTime.

var t0 = Instant.now
"* ... work ...
t0.elapsed     "* the Duration since t0

Class methods

now

The current monotonic instant.

native

Instance methods

-:Instant

The signed Duration between two Instants — positive when the receiver is the later one.

native

<:Instant

Whether the receiver is the earlier instant. Only <: is native; >: / <=: / >=: derive from it on Object.

native

==:

Whether the argument is the very same instant. A non-Instant argument is simply unequal — never an error.

native

elapsed

The time since this instant (now minus the receiver), as a Duration — the everyday stopwatch read.

native