SplitScript reference / Duration / subtract
Duration.subtract
Operator
Duration.subtract(other: Duration) -> Duration
Subtracts another duration and normalizes the result.
Negative results retain their full subsecond precision.
Parameters
other: The duration to subtract.
Effects: pure
Runtime behavior: available everywhere; synchronous
Examples
Measure the difference between two durations
let currentTime = Duration.fromSeconds(5.0)
let previousTime = Duration.fromSeconds(3.0)
let difference = currentTime.subtract(previousTime)