SplitScript reference / Instant

Instant

record

record Instant

Identifies one reading of the runtime's monotonic clock.

Instants are suitable for elapsed-time measurements such as delayed splits and debouncing. They are unrelated to calendar time and have no meaningful absolute value.

Examples

Capture a monotonic timestamp

let detectedAt: Instant = Instant.now()

Capabilities

MemberDescriptionAvailable through
EquatableSupports equality comparison.

Operators

MemberDescriptionAvailable through
==Reports whether this value and another value are equal.Available through Equatable
!=Reports whether this value and another value differ.Available through Equatable
+Offsets this instant by a duration.

Methods

MemberDescriptionAvailable through
durationSinceReturns the elapsed duration since an earlier instant.
elapsedReturns the duration elapsed since this instant.
hasElapsedReports whether at least the requested duration has elapsed.
nowReads the runtime's monotonic clock.