Struct HostTimespan
Stores a difference between two timestamps as a duration.
Implements
IComparable
IFormattable
Assembly: cs.temp.dll.dll
Syntax
public struct HostTimespan : IComparable, IComparable<HostTimespan>, IEquatable<HostTimespan>, IFormattable
Fields
Zero
Timespan representing zero time.
Declaration
public static readonly HostTimespan Zero
Field Value
Properties
Days
Duration in number of days.
Declaration
public double Days { get; }
Property Value
Type |
Description |
System.Double |
|
Hours
Duration in number of hours.
Declaration
public double Hours { get; }
Property Value
Type |
Description |
System.Double |
|
Milliseconds
Duration in number of milliseconds.
Declaration
public double Milliseconds { get; }
Property Value
Type |
Description |
System.Double |
|
Minutes
Duration in number of minutes.
Declaration
public double Minutes { get; }
Property Value
Type |
Description |
System.Double |
|
Seconds
Duration in number of seconds.
Declaration
public double Seconds { get; }
Property Value
Type |
Description |
System.Double |
|
Methods
Abs(HostTimespan)
Returns the absolute value of a timespan.
Declaration
public static HostTimespan Abs(HostTimespan timespan)
Parameters
Type |
Name |
Description |
HostTimespan |
timespan |
Timespan to use.
|
Returns
Clamp(HostTimespan, HostTimespan, HostTimespan)
Returns a clamped value of a timespan.
Declaration
public static HostTimespan Clamp(HostTimespan value, HostTimespan min, HostTimespan max)
Parameters
Returns
CompareTo(HostTimespan)
Declaration
public int CompareTo(HostTimespan other)
Parameters
Returns
Type |
Description |
System.Int32 |
|
CompareTo(Object)
Declaration
public int CompareTo(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Returns
Type |
Description |
System.Int32 |
|
Equals(HostTimespan)
Declaration
public bool Equals(HostTimespan other)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
System.ValueType.Equals(System.Object)
FromDays(Double)
Create a timespan from days.
Declaration
public static HostTimespan FromDays(double value)
Parameters
Type |
Name |
Description |
System.Double |
value |
Number of days.
|
Returns
FromHours(Double)
Create a timespan from hours.
Declaration
public static HostTimespan FromHours(double value)
Parameters
Type |
Name |
Description |
System.Double |
value |
Number of hours.
|
Returns
FromMilliseconds(Double)
Create a timespan from milliseconds.
Declaration
public static HostTimespan FromMilliseconds(double value)
Parameters
Type |
Name |
Description |
System.Double |
value |
Number of milliseconds.
|
Returns
FromMinutes(Double)
Create a timespan from minutes.
Declaration
public static HostTimespan FromMinutes(double value)
Parameters
Type |
Name |
Description |
System.Double |
value |
Number of minutes.
|
Returns
FromSeconds(Double)
Create a timespan from seconds.
Declaration
public static HostTimespan FromSeconds(double value)
Parameters
Type |
Name |
Description |
System.Double |
value |
Number of seconds.
|
Returns
FromStopwatchTicks(Int64)
Create a timespan with the provided ticks at stopwatch frequency.
Declaration
public static HostTimespan FromStopwatchTicks(long ticks)
Parameters
Type |
Name |
Description |
System.Int64 |
ticks |
Raw ticks.
|
Returns
FromTicks(Int64, Int64)
Create a timespan from raw ticks with provided frequency.
Declaration
public static HostTimespan FromTicks(long ticks, long frequency)
Parameters
Type |
Name |
Description |
System.Int64 |
ticks |
Raw ticks.
|
System.Int64 |
frequency |
Ticks per second.
|
Returns
FromTimeSpan(TimeSpan)
Create a timespan from the TimeSpan object.
Declaration
public static HostTimespan FromTimeSpan(TimeSpan value)
Parameters
Type |
Name |
Description |
TimeSpan |
value |
The TimeSpan object.
|
Returns
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
System.ValueType.GetHashCode()
GetStopwatchTicks()
Get raw ticks with stopwatch frequency.
Declaration
public long GetStopwatchTicks()
Returns
Type |
Description |
System.Int64 |
Raw stopwatch ticks.
|
GetTicks(Int64)
Get raw ticks with provided frequency.
Declaration
public long GetTicks(long frequency)
Parameters
Type |
Name |
Description |
System.Int64 |
frequency |
Ticks per second.
|
Returns
Type |
Description |
System.Int64 |
Raw ticks.
|
Max(HostTimespan, HostTimespan)
Returns the larger of the two timespans.
Declaration
public static HostTimespan Max(HostTimespan a, HostTimespan b)
Parameters
Returns
Min(HostTimespan, HostTimespan)
Returns the smaller of the two timespans.
Declaration
public static HostTimespan Min(HostTimespan a, HostTimespan b)
Parameters
Returns
Type |
Description |
HostTimespan |
The smaller of the two values.
|
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Overrides
System.ValueType.ToString()
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type |
Name |
Description |
System.String |
format |
|
IFormatProvider |
formatProvider |
|
Returns
Type |
Description |
System.String |
|
ToTimeSpan()
Get the TimeSpan equivalent.
Declaration
public TimeSpan ToTimeSpan()
Returns
Type |
Description |
TimeSpan |
|
Operators
Addition(HostTimespan, HostTimespan)
Declaration
public static HostTimespan operator +(HostTimespan lhs, HostTimespan rhs)
Parameters
Returns
Division(HostTimespan, HostTimespan)
Declaration
public static double operator /(HostTimespan lhs, HostTimespan rhs)
Parameters
Returns
Type |
Description |
System.Double |
|
Equality(HostTimespan, HostTimespan)
Declaration
public static bool operator ==(HostTimespan lhs, HostTimespan rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|
GreaterThan(HostTimespan, HostTimespan)
Declaration
public static bool operator>(HostTimespan lhs, HostTimespan rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|
GreaterThanOrEqual(HostTimespan, HostTimespan)
Declaration
public static bool operator >=(HostTimespan lhs, HostTimespan rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Inequality(HostTimespan, HostTimespan)
Declaration
public static bool operator !=(HostTimespan lhs, HostTimespan rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|
LessThan(HostTimespan, HostTimespan)
Declaration
public static bool operator <(HostTimespan lhs, HostTimespan rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|
LessThanOrEqual(HostTimespan, HostTimespan)
Declaration
public static bool operator <=(HostTimespan lhs, HostTimespan rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Subtraction(HostTimespan, HostTimespan)
Declaration
public static HostTimespan operator -(HostTimespan lhs, HostTimespan rhs)
Parameters
Returns
UnaryNegation(HostTimespan)
Declaration
public static HostTimespan operator -(HostTimespan time)
Parameters
Returns
Implements
IComparable
IComparable<>
IEquatable<>
IFormattable