SplitScript reference / Duration

Duration

record

record Duration

Represents a precise span of time.

Durations carry normalized whole seconds and nanoseconds and are used for timer game time. The nanosecond component is always between zero and 999,999,999, including for negative durations.

Examples

Represent an exact delay

let delay = Duration.fromSeconds(2)

Capabilities

MemberDescriptionAvailable through
EquatableSupports equality comparison.

Operators

MemberDescriptionAvailable through
+Adds another duration and normalizes the result.
>Reports whether this duration is longer than another duration.
>=Reports whether this duration is at least another duration.
<Reports whether this duration is shorter than another duration.
<=Reports whether this duration is no longer than another duration.
-Subtracts another duration and normalizes the result.
==Reports whether this value and another value are equal.Available through Equatable
!=Reports whether this value and another value differ.Available through Equatable

Methods

MemberDescriptionAvailable through
fromDaysConstructs a duration from days.
fromFramesConstructs a duration from frames.
fromHoursConstructs a duration from hours.
fromMillisecondsConstructs a duration from milliseconds.
fromMinutesConstructs a duration from minutes.
fromNanosecondsConstructs a duration from nanoseconds.
fromPartsConstructs a duration from seconds and nanoseconds.
fromSecondsConstructs a duration from seconds.
subsecondNanosecondsReturns the normalized subsecond nanosecond component.
totalMillisecondsReturns the complete duration as floating-point milliseconds.
totalSecondsReturns the complete duration as floating-point seconds.
wholeSecondsReturns the normalized whole-second component.
zeroConstructs a zero-length duration.