struct · System

TimeSpan

public struct System.TimeSpan : System.IHashable<System.TimeSpan>, System.IComparable<System.TimeSpan>

A length of time (negative too): ticks of 100 ns. a + b, a - b, -a, a * 2.5, a / 2, a / b, and the comparisons work on it; as text it is [-][d.]hh:mm:ss[.fffffff].

Tipo
struct
Espacio de nombres
System
Ensamblado
System.Core
Acceso
public
Archivo fuente
Time.ant

Herencia

Interfaces
IHashable<TSelf> IComparable<TSelf>

Constructores

constructor TimeSpan(ticks: i64)
#
constructor TimeSpan(hours: i32, minutes: i32, seconds: i32)
#
constructor TimeSpan(days: i32, hours: i32, minutes: i32, seconds: i32)
#
constructor TimeSpan(days: i32, hours: i32, minutes: i32, seconds: i32, milliseconds: i32)
#

Propiedades

static property TicksPerMicrosecond: i64
#

static read-only

static property TicksPerMillisecond: i64
#

static read-only

static property TicksPerSecond: i64
#

static read-only

static property TicksPerMinute: i64
#

static read-only

static property TicksPerHour: i64
#

static read-only

static property TicksPerDay: i64
#

static read-only

static property Zero: System.TimeSpan
#

static read-only

static property MaxValue: System.TimeSpan
#

static read-only

static property MinValue: System.TimeSpan
#

static read-only

property Ticks: i64
#

read-only

property Days: i32
#

read-only

The parts: whole days, then hours (0–23), minutes, seconds, milliseconds, microseconds, nanoseconds of the rest (negative for a negative length).

property Hours: i32
#

read-only

property Minutes: i32
#

read-only

property Seconds: i32
#

read-only

property Milliseconds: i32
#

read-only

property Microseconds: i32
#

read-only

property Nanoseconds: i32
#

read-only

property TotalDays: f64
#

read-only

The whole length in one unit.

property TotalHours: f64
#

read-only

property TotalMinutes: f64
#

read-only

property TotalSeconds: f64
#

read-only

property TotalMilliseconds: f64
#

read-only

(Held to ±922337203685477, as .NET does.)

property TotalMicroseconds: f64
#

read-only

property TotalNanoseconds: f64
#

read-only

Métodos

static method FromDays(days: i64) -> System.TimeSpan
#

static

A length in a unit: whole units exactly, fractions rounded toward zero to a tick.

static method FromHours(hours: i64) -> System.TimeSpan
#

static

static method FromMinutes(minutes: i64) -> System.TimeSpan
#

static

static method FromSeconds(seconds: i64) -> System.TimeSpan
#

static

static method FromMilliseconds(milliseconds: i64) -> System.TimeSpan
#

static

static method FromMicroseconds(microseconds: i64) -> System.TimeSpan
#

static

static method FromDays(days: f64) -> System.TimeSpan
#

static

static method FromHours(hours: f64) -> System.TimeSpan
#

static

static method FromMinutes(minutes: f64) -> System.TimeSpan
#

static

static method FromSeconds(seconds: f64) -> System.TimeSpan
#

static

static method FromMilliseconds(milliseconds: f64) -> System.TimeSpan
#

static

static method FromMicroseconds(microseconds: f64) -> System.TimeSpan
#

static

static method FromTicks(ticks: i64) -> System.TimeSpan
#

static

method Add(other: System.TimeSpan) -> System.TimeSpan
#
method Subtract(other: System.TimeSpan) -> System.TimeSpan
#
method Negate() -> System.TimeSpan
#
method Duration() -> System.TimeSpan
#

The length without its sign.

method Multiply(factor: f64) -> System.TimeSpan
#

Times a number, and divided by one (to the nearest tick, halves to even).

method Divide(divisor: f64) -> System.TimeSpan
#
method Divide(other: System.TimeSpan) -> f64
#

How many times other fits in this length.

method Equals(other: System.TimeSpan) -> bool
#
method Hash() -> u64
#
method CompareTo(other: System.TimeSpan) -> i32
#
static method Compare(a: System.TimeSpan, b: System.TimeSpan) -> i32
#

static

method ToString() -> System.String<u8>
#

[-][d.]hh:mm:ss[.fffffff] (the "c" format).

method ToString(format: System.String<u8>) -> System.String<u8>
#

As text by a format: "c" ([-][d.]hh:mm:ss[.fffffff]), "g" ([-][d:]h:mm:ss[.FFFFFFF]), "G" ([-]d:hh:mm:ss.fffffff), or a custom one of d…, h, hh, m, mm, s, ss, f…, F…, 'text' and \x.

static method Parse(text: System.String<u8>) -> System.TimeSpan
#

static

The length text writes: [-]d, [-][d.]h:mm[:ss[.fffffff]] or [-]d:h:mm:ss[.fffffff], spaces around allowed; a FormatError when it writes none.

static method TryParse(text: System.String<u8>) -> System.TimeSpan?
#

static

The length text writes, or null when it writes none.

Operadores y conversiones

static operator $op_Add(a: System.TimeSpan, b: System.TimeSpan) -> System.TimeSpan
#

static

static operator $op_Subtract(a: System.TimeSpan, b: System.TimeSpan) -> System.TimeSpan
#

static

static operator $op_Negate(a: System.TimeSpan) -> System.TimeSpan
#

static

static operator $op_Plus(a: System.TimeSpan) -> System.TimeSpan
#

static

static operator $op_Multiply(a: System.TimeSpan, factor: f64) -> System.TimeSpan
#

static

static operator $op_Multiply(factor: f64, a: System.TimeSpan) -> System.TimeSpan
#

static

static operator $op_Divide(a: System.TimeSpan, divisor: f64) -> System.TimeSpan
#

static

static operator $op_Divide(a: System.TimeSpan, b: System.TimeSpan) -> f64
#

static

static operator $op_Equal(a: System.TimeSpan, b: System.TimeSpan) -> bool
#

static

static operator $op_NotEqual(a: System.TimeSpan, b: System.TimeSpan) -> bool
#

static

static operator $op_Less(a: System.TimeSpan, b: System.TimeSpan) -> bool
#

static

static operator $op_LessEqual(a: System.TimeSpan, b: System.TimeSpan) -> bool
#

static

static operator $op_Greater(a: System.TimeSpan, b: System.TimeSpan) -> bool
#

static

static operator $op_GreaterEqual(a: System.TimeSpan, b: System.TimeSpan) -> bool
#

static

Miembros privados e internos (5)

field ticks: i64
#

private

static method TooLong() -> void
#

private static

static method NotANumber() -> void
#

private static

static method Interval(value: f64, scale: f64) -> System.TimeSpan
#

private static

value units of scale ticks, rounded toward zero.

static method Whole(value: i64, scale: i64) -> System.TimeSpan
#

private static

value whole units of scale ticks.

Código fuente

TimeSpan en Larva HIR, descompilado a partir de su Larva HIR.

System.TimeSpan.hir
// A length of time (negative too): ticks of 100 ns. `a + b`, `a - b`, `-a`, `a * 2.5`, `a / 2`, `a / b`, and the
// comparisons work on it; as text it is `[-][d.]hh:mm:ss[.fffffff]`.
public struct System.TimeSpan : System.IHashable<System.TimeSpan>, System.IComparable<System.TimeSpan>
{
    field ticks: i64
    static method TooLong() -> void
    static method NotANumber() -> void
    // `value` units of `scale` ticks, rounded toward zero.
    static method Interval(value: f64, scale: f64) -> System.TimeSpan
    // `value` whole units of `scale` ticks.
    static method Whole(value: i64, scale: i64) -> System.TimeSpan
    constructor TimeSpan(ticks: i64)
    constructor TimeSpan(hours: i32, minutes: i32, seconds: i32)
    constructor TimeSpan(days: i32, hours: i32, minutes: i32, seconds: i32)
    constructor TimeSpan(days: i32, hours: i32, minutes: i32, seconds: i32, milliseconds: i32)
    // A length in a unit: whole units exactly, fractions rounded toward zero to a tick.
    static method FromDays(days: i64) -> System.TimeSpan
    static method FromHours(hours: i64) -> System.TimeSpan
    static method FromMinutes(minutes: i64) -> System.TimeSpan
    static method FromSeconds(seconds: i64) -> System.TimeSpan
    static method FromMilliseconds(milliseconds: i64) -> System.TimeSpan
    static method FromMicroseconds(microseconds: i64) -> System.TimeSpan
    static method FromDays(days: f64) -> System.TimeSpan
    static method FromHours(hours: f64) -> System.TimeSpan
    static method FromMinutes(minutes: f64) -> System.TimeSpan
    static method FromSeconds(seconds: f64) -> System.TimeSpan
    static method FromMilliseconds(milliseconds: f64) -> System.TimeSpan
    static method FromMicroseconds(microseconds: f64) -> System.TimeSpan
    static method FromTicks(ticks: i64) -> System.TimeSpan
    method Add(other: System.TimeSpan) -> System.TimeSpan
    method Subtract(other: System.TimeSpan) -> System.TimeSpan
    method Negate() -> System.TimeSpan
    // The length without its sign.
    method Duration() -> System.TimeSpan
    // Times a number, and divided by one (to the nearest tick, halves to even).
    method Multiply(factor: f64) -> System.TimeSpan
    method Divide(divisor: f64) -> System.TimeSpan
    // How many times `other` fits in this length.
    method Divide(other: System.TimeSpan) -> f64
    static operator $op_Add(a: System.TimeSpan, b: System.TimeSpan) -> System.TimeSpan
    static operator $op_Subtract(a: System.TimeSpan, b: System.TimeSpan) -> System.TimeSpan
    static operator $op_Negate(a: System.TimeSpan) -> System.TimeSpan
    static operator $op_Plus(a: System.TimeSpan) -> System.TimeSpan
    static operator $op_Multiply(a: System.TimeSpan, factor: f64) -> System.TimeSpan
    static operator $op_Multiply(factor: f64, a: System.TimeSpan) -> System.TimeSpan
    static operator $op_Divide(a: System.TimeSpan, divisor: f64) -> System.TimeSpan
    static operator $op_Divide(a: System.TimeSpan, b: System.TimeSpan) -> f64
    static operator $op_Equal(a: System.TimeSpan, b: System.TimeSpan) -> bool
    static operator $op_NotEqual(a: System.TimeSpan, b: System.TimeSpan) -> bool
    static operator $op_Less(a: System.TimeSpan, b: System.TimeSpan) -> bool
    static operator $op_LessEqual(a: System.TimeSpan, b: System.TimeSpan) -> bool
    static operator $op_Greater(a: System.TimeSpan, b: System.TimeSpan) -> bool
    static operator $op_GreaterEqual(a: System.TimeSpan, b: System.TimeSpan) -> bool
    method Equals(other: System.TimeSpan) -> bool
    method Hash() -> u64
    method CompareTo(other: System.TimeSpan) -> i32
    static method Compare(a: System.TimeSpan, b: System.TimeSpan) -> i32
    // `[-][d.]hh:mm:ss[.fffffff]` (the "c" format).
    method ToString() -> System.String<u8>
    // As text by a format: "c" (`[-][d.]hh:mm:ss[.fffffff]`), "g" (`[-][d:]h:mm:ss[.FFFFFFF]`), "G"
    // (`[-]d:hh:mm:ss.fffffff`), or a custom one of d…, h, hh, m, mm, s, ss, f…, F…, 'text' and \x.
    method ToString(format: System.String<u8>) -> System.String<u8>
    // The length `text` writes: `[-]d`, `[-][d.]h:mm[:ss[.fffffff]]` or `[-]d:h:mm:ss[.fffffff]`, spaces around
    // allowed; a FormatError when it writes none.
    static method Parse(text: System.String<u8>) -> System.TimeSpan
    // The length `text` writes, or null when it writes none.
    static method TryParse(text: System.String<u8>) -> System.TimeSpan?
    static property TicksPerMicrosecond: i64
    static property TicksPerMillisecond: i64
    static property TicksPerSecond: i64
    static property TicksPerMinute: i64
    static property TicksPerHour: i64
    static property TicksPerDay: i64
    static property Zero: System.TimeSpan
    static property MaxValue: System.TimeSpan
    static property MinValue: System.TimeSpan
    property Ticks: i64
    // The parts: whole days, then hours (0–23), minutes, seconds, milliseconds, microseconds, nanoseconds of the
    // rest (negative for a negative length).
    property Days: i32
    property Hours: i32
    property Minutes: i32
    property Seconds: i32
    property Milliseconds: i32
    property Microseconds: i32
    property Nanoseconds: i32
    // The whole length in one unit.
    property TotalDays: f64
    property TotalHours: f64
    property TotalMinutes: f64
    property TotalSeconds: f64
    // (Held to ±922337203685477, as .NET does.)
    property TotalMilliseconds: f64
    property TotalMicroseconds: f64
    property TotalNanoseconds: f64
}
Esc