CVB.Net 14.0
UsTimeSpan Struct Reference

Time span with micro second granularity. More...

Inherits IComparable, IComparable< UsTimeSpan >, and IEquatable< UsTimeSpan >.

Public Member Functions

 UsTimeSpan (long ticks)
 Initializes this timespan from the given ticks . More...
 
 UsTimeSpan (int days, int hours, int minutes, int seconds, int milliseconds, int microseconds)
 Initializes this timespan from the given times. More...
 
 UsTimeSpan (int days, int hours, int minutes, int seconds, int milliseconds)
 Initializes this timespan from the given times. More...
 
 UsTimeSpan (int days, int hours, int minutes, int seconds)
 Initializes this timespan from the given times. More...
 
 UsTimeSpan (int hours, int minutes, int seconds)
 Initializes this timespan from the given times. More...
 
 UsTimeSpan (TimeSpan timeSpan)
 Creates a UsTimeSpan from the given timeSpan . More...
 
override bool Equals (object obj)
 Returns a value indicating whether this instance is equal to the given obj . More...
 
override int GetHashCode ()
 Returns a hash code for this instance. More...
 
override string ToString ()
 Returns the string representation of the value of this instance. More...
 
UsTimeSpan Add (UsTimeSpan timeSpan)
 Gets the sum of this and the given timeSpan . More...
 
UsTimeSpan Duration ()
 Gets new UsTimeSpan whose value is the absolute value of this object. More...
 
UsTimeSpan Negate ()
 Gets the same value of this object with a changed sign. More...
 
UsTimeSpan Subtract (UsTimeSpan timeSpan)
 Gets the difference of this and the given timeSpan . More...
 
int CompareTo (object obj)
 Compares this instance to a specified object and returns an integer that indicates whether this instance is shorter than, equal to, or longer than the specified object. More...
 
int CompareTo (UsTimeSpan other)
 Compares this instance to a specified object and returns an integer that indicates whether this instance is shorter than, equal to, or longer than the specified object. More...
 
bool Equals (UsTimeSpan other)
 Returns a value indicating whether this instance is equal to given other object. More...
 

Static Public Member Functions

static UsTimeSpan FromDays (double days)
 Returns UsTimeSpan that represents a specified number of days . More...
 
static UsTimeSpan FromHours (double hours)
 Returns UsTimeSpan that represents a specified number of hours . More...
 
static UsTimeSpan FromMicroseconds (double microseconds)
 Returns UsTimeSpan that represents a specified number of microseconds . More...
 
static UsTimeSpan FromMilliseconds (double milliseconds)
 Returns UsTimeSpan that represents a specified number of milliseconds . More...
 
static UsTimeSpan FromMinutes (double minutes)
 Returns UsTimeSpan that represents a specified number of minutes . More...
 
static UsTimeSpan FromSeconds (double seconds)
 Returns UsTimeSpan that represents a specified number of seconds . More...
 
static UsTimeSpan FromTicks (long ticks)
 Returns UsTimeSpan that represents a specified number of ticks . More...
 
static operator TimeSpan (UsTimeSpan timeSpan)
 Explicitly converts the timeSpan into a TimeSpan object. More...
 
static implicit operator UsTimeSpan (TimeSpan timeSpan)
 Implicitly converts the given timeSpan into a UsTimeSpan object. More...
 
static UsTimeSpan operator- (UsTimeSpan other)
 Gets the same value of other object with a changed sign. More...
 
static UsTimeSpan operator- (UsTimeSpan lhs, UsTimeSpan rhs)
 Subtracts rhs from lhs . More...
 
static UsTimeSpan operator+ (UsTimeSpan other)
 Gets the same value of other object. More...
 
static UsTimeSpan operator+ (UsTimeSpan lhs, UsTimeSpan rhs)
 Adds lhs to rhs . More...
 
static bool operator!= (UsTimeSpan lhs, UsTimeSpan rhs)
 Inequality operator. More...
 
static bool operator== (UsTimeSpan lhs, UsTimeSpan rhs)
 Equality operator. More...
 
static bool operator< (UsTimeSpan lhs, UsTimeSpan rhs)
 Less operator. More...
 
static bool operator<= (UsTimeSpan lhs, UsTimeSpan rhs)
 Less or equal to operator. More...
 
static bool operator> (UsTimeSpan lhs, UsTimeSpan rhs)
 Greater operator. More...
 
static bool operator>= (UsTimeSpan lhs, UsTimeSpan rhs)
 Greater or equal operator. More...
 

Static Public Attributes

static readonly UsTimeSpan Zero = new UsTimeSpan(0)
 Represents the zero UsTimeSpan value. This field is read-only.
 
static readonly UsTimeSpan MaxValue = new UsTimeSpan(long.MaxValue)
 Represents the maximum UsTimeSpan value. This field is read-only.
 
static readonly UsTimeSpan MinValue = new UsTimeSpan(long.MinValue)
 Represents the minimum UsTimeSpan value. This field is read-only.
 
const long TicksPerDay = 864000000000
 Represents the number of ticks in 1 day.
 
const long TicksPerHour = 36000000000
 Represents the number of ticks in 1 hour.
 
const long TicksPerMicrosecond = 10
 Represents the number of ticks in 1 microsecond.
 
const long TicksPerMillisecond = 10000
 Represents the number of ticks in 1 millisecond.
 
const long TicksPerMinute = 600000000
 Represents the number of ticks in 1 minute.
 
const long TicksPerSecond = 10000000
 Represents the number of ticks in 1 second.
 

Properties

int Days [get]
 Gets the days component of the time interval represented by this object.
 
int Hours [get]
 Gets the hours component of the time interval represented by this object.
 
int Minutes [get]
 Gets the minutes component of the time interval represented by this object.
 
int Seconds [get]
 Gets the second component of the time interval represented by this object.
 
int Milliseconds [get]
 Gets the millisecond component of the time interval represented by this object.
 
int Microseconds [get]
 Gets the microsecond component of the time interval represented by this object.
 
double TotalDays [get]
 Gets the whole value of this object expressed in whole and fractional days.
 
double TotalHours [get]
 Gets the whole value of this object expressed in whole and fractional hours.
 
double TotalMinutes [get]
 Gets the whole value of this object expressed in whole and fractional minutes.
 
double TotalSeconds [get]
 Gets the whole value of this object expressed in whole and fractional seconds.
 
double TotalMilliseconds [get]
 Gets the whole value of this object expressed in whole and fractional milliseconds.
 
double TotalMicroseconds [get]
 Gets the whole value of this object expressed in whole and fractional microseconds.
 
long TotalTicks [get]
 Gets the whole value of this object expressed in ticks.
 

Detailed Description

Time span with micro second granularity.

Constructor & Destructor Documentation

◆ UsTimeSpan() [1/6]

UsTimeSpan ( long  ticks)

Initializes this timespan from the given ticks .

Parameters
ticksTicks to initialize with.

◆ UsTimeSpan() [2/6]

UsTimeSpan ( int  days,
int  hours,
int  minutes,
int  seconds,
int  milliseconds,
int  microseconds 
)

Initializes this timespan from the given times.

Parameters
daysA number of days
hoursA number of hours
minutesA number of minuts.
secondsA number of seconds.
millisecondsA number of milliseconds.
microsecondsA number of microseconds.

◆ UsTimeSpan() [3/6]

UsTimeSpan ( int  days,
int  hours,
int  minutes,
int  seconds,
int  milliseconds 
)

Initializes this timespan from the given times.

Parameters
daysA number of days
hoursA number of hours
minutesA number of minuts.
secondsA number of seconds.
millisecondsA number of milliseconds.

◆ UsTimeSpan() [4/6]

UsTimeSpan ( int  days,
int  hours,
int  minutes,
int  seconds 
)

Initializes this timespan from the given times.

Parameters
daysA number of days
hoursA number of hours
minutesA number of minuts.
secondsA number of seconds.

◆ UsTimeSpan() [5/6]

UsTimeSpan ( int  hours,
int  minutes,
int  seconds 
)

Initializes this timespan from the given times.

Parameters
hoursA number of hours
minutesA number of minuts.
secondsA number of seconds.

◆ UsTimeSpan() [6/6]

UsTimeSpan ( TimeSpan  timeSpan)

Creates a UsTimeSpan from the given timeSpan .

Parameters
timeSpanTime span to create this on of.

Member Function Documentation

◆ Add()

UsTimeSpan Add ( UsTimeSpan  timeSpan)

Gets the sum of this and the given timeSpan .

Parameters
timeSpanThe span to add.
Returns
Sum value.

◆ CompareTo() [1/2]

int CompareTo ( object  obj)

Compares this instance to a specified object and returns an integer that indicates whether this instance is shorter than, equal to, or longer than the specified object.

Parameters
objAn object to compare, or null.
Returns
Value Condition -1 This instance is shorter than value. 0 This instance is equal to value. 1 This instance is longer than value.-or- value is null.

◆ CompareTo() [2/2]

int CompareTo ( UsTimeSpan  other)

Compares this instance to a specified object and returns an integer that indicates whether this instance is shorter than, equal to, or longer than the specified object.

Parameters
otherAn object to compare.
Returns
Value Condition -1 This instance is shorter than value. 0 This instance is equal to value. 1 This instance is longer than value.

◆ Duration()

UsTimeSpan Duration ( )

Gets new UsTimeSpan whose value is the absolute value of this object.

Returns
Absolute time span.

◆ Equals() [1/2]

override bool Equals ( object  obj)

Returns a value indicating whether this instance is equal to the given obj .

Parameters
objAn object to compare with this instance.
Returns
true if obj represents the same time interval as this instance; false otherwise.

◆ Equals() [2/2]

bool Equals ( UsTimeSpan  other)

Returns a value indicating whether this instance is equal to given other object.

Parameters
otherObject to compare with this instance.
Returns
true if other represents the same time interval as this instance; false otherwise.

◆ FromDays()

static UsTimeSpan FromDays ( double  days)
static

Returns UsTimeSpan that represents a specified number of days .

Parameters
daysA number of days.
Returns
UsTimeSpan that represents that value.

◆ FromHours()

static UsTimeSpan FromHours ( double  hours)
static

Returns UsTimeSpan that represents a specified number of hours .

Parameters
hoursA number of hours.
Returns
UsTimeSpan that represents that value.

◆ FromMicroseconds()

static UsTimeSpan FromMicroseconds ( double  microseconds)
static

Returns UsTimeSpan that represents a specified number of microseconds .

Parameters
microsecondsA number of microseconds.
Returns
UsTimeSpan that represents that value.

◆ FromMilliseconds()

static UsTimeSpan FromMilliseconds ( double  milliseconds)
static

Returns UsTimeSpan that represents a specified number of milliseconds .

Parameters
millisecondsA number of milliseconds.
Returns
UsTimeSpan that represents that value.

◆ FromMinutes()

static UsTimeSpan FromMinutes ( double  minutes)
static

Returns UsTimeSpan that represents a specified number of minutes .

Parameters
minutesA number of micro seconds.
Returns
UsTimeSpan that represents that value.

◆ FromSeconds()

static UsTimeSpan FromSeconds ( double  seconds)
static

Returns UsTimeSpan that represents a specified number of seconds .

Parameters
secondsA number of seconds.
Returns
UsTimeSpan that represents that value.

◆ FromTicks()

static UsTimeSpan FromTicks ( long  ticks)
static

Returns UsTimeSpan that represents a specified number of ticks .

Parameters
ticksUnitless ticks.
Returns
UsTimeSpan that represents that value.

◆ GetHashCode()

override int GetHashCode ( )

Returns a hash code for this instance.

Returns
A 32-bit signed integer hash code.

◆ Negate()

UsTimeSpan Negate ( )

Gets the same value of this object with a changed sign.

Returns
Negated value.

◆ operator TimeSpan()

static operator TimeSpan ( UsTimeSpan  timeSpan)
explicitstatic

Explicitly converts the timeSpan into a TimeSpan object.

Only explicit as this is a narrowing conversion.

Parameters
timeSpanTime span to convert.
Returns
Millisecond granularity time span.

◆ operator UsTimeSpan()

static implicit operator UsTimeSpan ( TimeSpan  timeSpan)
static

Implicitly converts the given timeSpan into a UsTimeSpan object.

Parameters
timeSpanTime span to convert.
Returns
Microsecond granularity time span.

◆ operator!=()

static bool operator!= ( UsTimeSpan  lhs,
UsTimeSpan  rhs 
)
static

Inequality operator.

Parameters
lhsLeft hand side operand.
rhsRight hand side operand.
Returns
true if lhs and rhs are not equal.

◆ operator+() [1/2]

static UsTimeSpan operator+ ( UsTimeSpan  lhs,
UsTimeSpan  rhs 
)
static

Adds lhs to rhs .

Parameters
lhsLeft hand side operand.
rhsRight hand side operand.
Returns
Sum value.

◆ operator+() [2/2]

static UsTimeSpan operator+ ( UsTimeSpan  other)
static

Gets the same value of other object.

Parameters
otherValue.
Returns
Value

◆ operator-() [1/2]

static UsTimeSpan operator- ( UsTimeSpan  lhs,
UsTimeSpan  rhs 
)
static

Subtracts rhs from lhs .

Parameters
lhsLeft hand side operand.
rhsRight hand side operand.
Returns
Difference value.

◆ operator-() [2/2]

static UsTimeSpan operator- ( UsTimeSpan  other)
static

Gets the same value of other object with a changed sign.

Parameters
otherValue to negate.
Returns
Negated value

◆ operator<()

static bool operator< ( UsTimeSpan  lhs,
UsTimeSpan  rhs 
)
static

Less operator.

Parameters
lhsLeft hand side operand.
rhsRight hand side operand.
Returns
true if lhs is less than rhs .

◆ operator<=()

static bool operator<= ( UsTimeSpan  lhs,
UsTimeSpan  rhs 
)
static

Less or equal to operator.

Parameters
lhsLeft hand side operand.
rhsRight hand side operand.
Returns
true if lhs is less than or equal to rhs .

◆ operator==()

static bool operator== ( UsTimeSpan  lhs,
UsTimeSpan  rhs 
)
static

Equality operator.

Parameters
lhsLeft hand side operand.
rhsRight hand side operand.
Returns
true if lhs and rhs are equal.

◆ operator>()

static bool operator> ( UsTimeSpan  lhs,
UsTimeSpan  rhs 
)
static

Greater operator.

Parameters
lhsLeft hand side operand.
rhsRight hand side operand.
Returns
true if lhs is greater than rhs .

◆ operator>=()

static bool operator>= ( UsTimeSpan  lhs,
UsTimeSpan  rhs 
)
static

Greater or equal operator.

Parameters
lhsLeft hand side operand.
rhsRight hand side operand.
Returns
true if lhs is greater than or equal to rhs .

◆ Subtract()

UsTimeSpan Subtract ( UsTimeSpan  timeSpan)

Gets the difference of this and the given timeSpan .

Parameters
timeSpanThe span to subtract.
Returns
Difference value.

◆ ToString()

override string ToString ( )

Returns the string representation of the value of this instance.

Returns
A string in the form [-][d.]hh:mm[:ss[.fffffff]]. Elements in square brackets may not be included. Colons and periods are literal characters.