SplitScript reference / Instant / durationSince

Instant.durationSince

Method

Instant.durationSince(earlier: Instant) -> Duration

Returns the elapsed duration since an earlier instant.

The result is zero when earlier is later than the receiver, matching the saturating behavior expected for polling and debounce logic.

Parameters

  • earlier: The earlier monotonic clock reading.

Effects: pure

Runtime behavior: available everywhere; synchronous

Examples

Measure between two clock readings

let startedAt = Instant.now()
let finishedAt = Instant.now()
let elapsed = finishedAt.durationSince(startedAt)