Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Struct

Duration

struct Duration

Module: System.Time
Assembly: System.Runtime.dll
Source file: Duration.rvn

Inheritance: Object → ValueType → Duration
Implements: ComparableTo<Duration>, EquatableTo<Duration>, Formattable

A signed elapsed duration represented by 100-nanosecond ticks.

Properties

1 item
Ticks: long Gets the stored 100-nanosecond tick count.

Methods

10 items
CompareTo(other: Duration) -> int Compares this value with the other value; returns a negative integer, zero or a positive integer for less than, equal to or greater than. Implements ComparableTo<Duration>.CompareTo
Equals(other: Duration) -> bool Compares the complete signed tick count. Implements EquatableTo<Duration>.Equals
Equals(other: object?) -> bool Compares another boxed Duration by tick count; null and other types are unequal. Overrides Object.Equals
Static member: FromTicks(ticks: long) -> Duration Creates a value from 100-nanosecond ticks; TimeOfDay rejects ticks outside a single day.
GetHashCode() -> int Returns an execution-local value hash consistent with tick equality; not a persistent identifier. Overrides Object.GetHashCode
GetType() -> TypeInfo Returns metadata for the concrete runtime type of this instance. Inherited from Object.GetType
Static member: Parse(value: string) -> Result<Duration, DateTimeParseError> Parses invariant [-][d.]hh:mm:ss[.fraction], with 1–8 day digits and 1–7 fraction digits.
ToString(format: string, culture: Culture) -> string Supports empty/c/t/T (invariant), g (optional day and fractional digits) and G (day and seven fractional digits always present). Swedish g/G uses a comma. Unsupported specifiers fa… Implements Formattable.ToString
ToString(format: string) -> string Formats with Culture.Current for g/G; c, t and T are invariant.
ToString() -> string Formats the invariant constant representation, including every tick of precision. Overrides Object.ToString