Skip to main content

Struct TimePeriod

Represents a sub-millisecond-capable Time Period

Assembly: Meadow.Units.dll​
View Source​
Declaration
[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​
Declaration
public static TimePeriod Zero { get; }

Nanoseconds​

Gets the time period value in nanoseconds.

View Source​
Declaration
public readonly double Nanoseconds { get; }

Microseconds​

Gets the time period value in microseconds.

View Source​
Declaration
public readonly double Microseconds { get; }

Milliseconds​

Gets the time period value in milliseconds.

View Source​
Declaration
public readonly double Milliseconds { get; }

Seconds​

Gets the time period value in seconds.

View Source​
Declaration
public readonly double Seconds { get; }

Minutes​

Gets the time period value in minutes.

View Source​
Declaration
public readonly double Minutes { get; }

Hours​

Gets the time period value in hours.

View Source​
Declaration
public readonly double Hours { get; }

Days​

Gets the time period value in days.

View Source​
Declaration
public readonly double Days { get; }

Methods​

FromCanonical(double)​

Creates a TimePeriod instance from a canonical (seconds) value

View Source​
Declaration
public static TimePeriod FromCanonical(double seconds)
Returns​

Meadow.Units.TimePeriod

Parameters​
TypeName
System.Doubleseconds

ToCanonical()​

Gets the value of the TimePeriod in Canonical (seconds) units

View Source​
Declaration
public double ToCanonical()
Returns​

System.Double

GetCanonicalUnitType()​

Gets the enum value that represents the canonical unit of measurement for this type.

View Source​
Declaration
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​
Declaration
[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​
TypeNameDescription
Meadow.Units.TimePeriod.UnitTypeconvertToThe unit type to convert to.

FromSeconds(double)​

Creates a new Meadow.Units.TimePeriod from the specified number of seconds.

View Source​
Declaration
[Pure]
public static TimePeriod FromSeconds(double seconds)
Returns​

Meadow.Units.TimePeriod: A new Meadow.Units.TimePeriod representing the specified number of seconds.

Parameters​
TypeNameDescription
System.DoublesecondsThe number of seconds.

FromFileTime(long)​

Creates a Meadow.Units.TimePeriod instance from a specified file time.

View Source​
Declaration
[Pure]
public static TimePeriod FromFileTime(long fileTime)
Returns​

Meadow.Units.TimePeriod: A Meadow.Units.TimePeriod representing the specified file time, converted to nanoseconds.

Parameters​
TypeNameDescription
System.Int64fileTimeThe 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​
Declaration
[Pure]
public static TimePeriod FromMilliseconds(double milliseconds)
Returns​

Meadow.Units.TimePeriod: A new Meadow.Units.TimePeriod representing the specified number of milliseconds.

Parameters​
TypeNameDescription
System.DoublemillisecondsThe number of milliseconds.

FromMicroseconds(double)​

Creates a new Meadow.Units.TimePeriod from the specified number of microseconds.

View Source​
Declaration
[Pure]
public static TimePeriod FromMicroseconds(double microseconds)
Returns​

Meadow.Units.TimePeriod: A new Meadow.Units.TimePeriod representing the specified number of microseconds.

Parameters​
TypeNameDescription
System.DoublemicrosecondsThe number of microseconds.

ToString(string, IFormatProvider)​

Converts the Meadow.Units.TimePeriod to its string representation using the specified format and format provider.

View Source​
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Returns​

System.String: A string representation of the value of the current Meadow.Units.TimePeriod instance.

Parameters​
TypeNameDescription
System.StringformatA standard or custom format string.
System.IFormatProviderformatProviderAn object that supplies culture-specific formatting information.

Add(TimePeriod)​

Adds the specified Meadow.Units.TimePeriod to the current Meadow.Units.TimePeriod.

View Source​
Declaration
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​
TypeNameDescription
Meadow.Units.TimePeriodperiodThe Meadow.Units.TimePeriod to add.

CompareTo(object)​

Compares a TimePeriod to another object

View Source​
Declaration
public int CompareTo(object obj)
Returns​

System.Int32

Parameters​
TypeNameDescription
System.ObjectobjThe object to compare

CompareTo(TimePeriod)​

Compares two TimePeriods

View Source​
Declaration
public int CompareTo(TimePeriod other)
Returns​

System.Int32

Parameters​
TypeName
Meadow.Units.TimePeriodother

CompareTo(TimeSpan)​

Compares a TimePeriod to a TimeSpan

View Source​
Declaration
public int CompareTo(TimeSpan other)
Returns​

System.Int32

Parameters​
TypeName
System.TimeSpanother

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>