Struct TimePeriod
Represents a sub-millisecond-capable Time Period
Assembly: Meadow.Units.dll
View Source
[Serializable]
public struct TimePeriod : IUnit<TimePeriod, TimePeriod.UnitType>, IUnit, IComparable, IFormattable, IComparable<TimePeriod>, IComparable<TimeSpan>
Implements:
Meadow.Units.IUnit<Meadow.Units.TimePeriod,Meadow.Units.TimePeriod.UnitType>, Meadow.Units.IUnit, System.IComparable, System.IFormattable, System.IComparable<Meadow.Units.TimePeriod>, System.IComparable<System.TimeSpan>
Properties
Zero
Gets a TimePeriod of zero time
View Source
public static TimePeriod Zero { get; }
Nanoseconds
Gets the time period value in nanoseconds.
View Source
public readonly double Nanoseconds { get; }
Microseconds
Gets the time period value in microseconds.
View Source
public readonly double Microseconds { get; }
Milliseconds
Gets the time period value in milliseconds.
View Source
public readonly double Milliseconds { get; }
Seconds
Gets the time period value in seconds.
View Source
public readonly double Seconds { get; }
Minutes
Gets the time period value in minutes.
View Source
public readonly double Minutes { get; }
Hours
Gets the time period value in hours.
View Source
public readonly double Hours { get; }
Days
Gets the time period value in days.
View Source
public readonly double Days { get; }
Methods
FromCanonical(double)
Creates a TimePeriod instance from a canonical (seconds) value
View Source
public static TimePeriod FromCanonical(double seconds)
Returns
Parameters
| Type | Name |
|---|---|
System.Double | seconds |
ToCanonical()
Gets the value of the TimePeriod in Canonical (seconds) units
View Source
public double ToCanonical()
Returns
System.Double
GetCanonicalUnitType()
Gets the enum value that represents the canonical unit of measurement for this type.
View Source
public TimePeriod.UnitType GetCanonicalUnitType()
Returns
Meadow.Units.TimePeriod.UnitType: The canonical unit type
From(UnitType)
Converts the current Meadow.Units.TimePeriod value to the specified unit type.
View Source
[Pure]
public readonly double From(TimePeriod.UnitType convertTo)
Returns
System.Double: The value of the current Meadow.Units.TimePeriod in the specified unit type.
Parameters
| Type | Name | Description |
|---|---|---|
| Meadow.Units.TimePeriod.UnitType | convertTo | The unit type to convert to. |
FromSeconds(double)
Creates a new Meadow.Units.TimePeriod from the specified number of seconds.
View Source
[Pure]
public static TimePeriod FromSeconds(double seconds)
Returns
Meadow.Units.TimePeriod: A new Meadow.Units.TimePeriod representing the specified number of seconds.
Parameters
| Type | Name | Description |
|---|---|---|
System.Double | seconds | The number of seconds. |
FromFileTime(long)
Creates a Meadow.Units.TimePeriod instance from a specified file time.
View Source
[Pure]
public static TimePeriod FromFileTime(long fileTime)
Returns
Meadow.Units.TimePeriod: A Meadow.Units.TimePeriod representing the specified file time, converted to nanoseconds.
Parameters
| Type | Name | Description |
|---|---|---|
System.Int64 | fileTime | The file time, expressed as the number of 100-nanosecond intervals since January 1, 1601 (UTC). |
FromMilliseconds(double)
Creates a new Meadow.Units.TimePeriod from the specified number of milliseconds.
View Source
[Pure]
public static TimePeriod FromMilliseconds(double milliseconds)
Returns
Meadow.Units.TimePeriod: A new Meadow.Units.TimePeriod representing the specified number of milliseconds.
Parameters
| Type | Name | Description |
|---|---|---|
System.Double | milliseconds | The number of milliseconds. |
FromMicroseconds(double)
Creates a new Meadow.Units.TimePeriod from the specified number of microseconds.
View Source
[Pure]
public static TimePeriod FromMicroseconds(double microseconds)
Returns
Meadow.Units.TimePeriod: A new Meadow.Units.TimePeriod representing the specified number of microseconds.
Parameters
| Type | Name | Description |
|---|---|---|
System.Double | microseconds | The number of microseconds. |
ToString(string, IFormatProvider)
Converts the Meadow.Units.TimePeriod to its string representation using the specified format and format provider.
View Source
public string ToString(string format, IFormatProvider formatProvider)
Returns
System.String: A string representation of the value of the current Meadow.Units.TimePeriod instance.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | format | A standard or custom format string. |
System.IFormatProvider | formatProvider | An object that supplies culture-specific formatting information. |
Add(TimePeriod)
Adds the specified Meadow.Units.TimePeriod to the current Meadow.Units.TimePeriod.
View Source
public TimePeriod Add(TimePeriod period)
Returns
Meadow.Units.TimePeriod: A new Meadow.Units.TimePeriod that is the sum of the current instance and the specified Meadow.Units.TimePeriod.
Parameters
| Type | Name | Description |
|---|---|---|
| Meadow.Units.TimePeriod | period | The Meadow.Units.TimePeriod to add. |
CompareTo(object)
Compares a TimePeriod to another object
View Source
public int CompareTo(object obj)
Returns
System.Int32
Parameters
| Type | Name | Description |
|---|---|---|
System.Object | obj | The object to compare |
CompareTo(TimePeriod)
Compares two TimePeriods
View Source
public int CompareTo(TimePeriod other)
Returns
System.Int32
Parameters
| Type | Name |
|---|---|
| Meadow.Units.TimePeriod | other |
CompareTo(TimeSpan)
Compares a TimePeriod to a TimeSpan
View Source
public int CompareTo(TimeSpan other)
Returns
System.Int32
Parameters
| Type | Name |
|---|---|
System.TimeSpan | other |
Implements
Meadow.Units.IUnit<Meadow.Units.TimePeriod,Meadow.Units.TimePeriod.UnitType>- Meadow.Units.IUnit
System.IComparableSystem.IFormattableSystem.IComparable<Meadow.Units.TimePeriod>System.IComparable<System.TimeSpan>