SplitScript reference / Duration / fromSeconds

Duration.fromSeconds

Function

Duration.fromSeconds<T>(seconds: T) -> Duration where T: Numeric

Constructs a duration from seconds.

Every integer and floating-point type is accepted. Integer inputs use an exact conversion without passing through floating point; fractional inputs retain nanosecond precision.

Parameters

  • seconds: The number of elapsed seconds.

Effects: pure

Runtime behavior: available everywhere; synchronous

Examples

Convert an integer counter to game time

let elapsed = Duration.fromSeconds(125)