SplitScript reference / Instant / add

Instant.add

Operator

Instant.add(duration: Duration) -> Instant

Offsets this instant by a duration.

This method implements Instant.add. Results before the monotonic clock's zero point clamp to zero, and results beyond the largest representable instant clamp to that maximum. The calculation preserves nanosecond precision and does not wrap.

Parameters

  • duration: The signed duration by which to offset the instant.

Effects: pure

Runtime behavior: available everywhere; synchronous

Examples

Calculate a deadline

let startedAt = Instant.now()
let deadline = startedAt + Duration.fromMilliseconds(250.0)