SplitScript reference / Duration / fromMilliseconds

Duration.fromMilliseconds

Function

Duration.fromMilliseconds<T>(milliseconds: T) -> Duration where T: Numeric

Constructs a duration from milliseconds.

Every integer and floating-point type is accepted. Integer inputs are converted exactly, including negative values; floating-point inputs may include fractional milliseconds and are converted through fromSeconds. When porting C#, this is the direct replacement for TimeSpan.FromMilliseconds.

Parameters

  • milliseconds: The number of elapsed milliseconds.

Effects: pure

Runtime behavior: available everywhere; synchronous

Examples

Convert milliseconds to game time

let elapsed = Duration.fromMilliseconds(1_250)