Class TimeSpanExtensions
- Namespace
- Cuemon.Extensions
- Assembly
- Cuemon.Extensions.Core.dll
Extension methods for the TimeSpan struct.
public static class TimeSpanExtensions
- Inheritance
-
TimeSpanExtensions
Fields
TicksPerMicrosecond
Represents the number of ticks in 1 microsecond. This field is constant.
public const double TicksPerMicrosecond = 10
Field Value
TicksPerNanosecond
Represents the number of ticks in 1 nanosecond. This field is constant.
public const double TicksPerNanosecond = 0.01
Field Value
Methods
Ceiling(TimeSpan, double, TimeUnit)
Returns a TimeSpan value that is rounded towards positive infinity.
public static TimeSpan Ceiling(this TimeSpan value, double interval, TimeUnit timeUnit)
Parameters
valueTimeSpanA TimeSpan value to be rounded.
intervaldoubleThe double value that in combination with
timeUnitspecifies the rounding ofvalue.timeUnitTimeUnitOne of the enumeration values that specifies the time unit of
interval.
Returns
Ceiling(TimeSpan, TimeSpan)
Returns a TimeSpan value that is rounded towards positive infinity.
public static TimeSpan Ceiling(this TimeSpan value, TimeSpan interval)
Parameters
valueTimeSpanA TimeSpan value to be rounded.
intervalTimeSpanThe TimeSpan value that specifies the rounding of
value.
Returns
Floor(TimeSpan, double, TimeUnit)
Returns a TimeSpan value that is rounded towards negative infinity.
public static TimeSpan Floor(this TimeSpan value, double interval, TimeUnit timeUnit)
Parameters
valueTimeSpanA TimeSpan value to be rounded.
intervaldoubleThe double value that in combination with
timeUnitspecifies the rounding ofvalue.timeUnitTimeUnitOne of the enumeration values that specifies the time unit of
interval.
Returns
Floor(TimeSpan, TimeSpan)
Returns a TimeSpan value that is rounded towards negative infinity.
public static TimeSpan Floor(this TimeSpan value, TimeSpan interval)
Parameters
valueTimeSpanA TimeSpan value to be rounded.
intervalTimeSpanThe TimeSpan value that specifies the rounding of
value.
Returns
GetTotalMicroseconds(TimeSpan)
Gets the total number of microseconds represented by the specified TimeSpan structure.
public static double GetTotalMicroseconds(this TimeSpan value)
Parameters
Returns
GetTotalNanoseconds(TimeSpan)
Gets the total number of nanoseconds represented by the specified TimeSpan structure.
public static double GetTotalNanoseconds(this TimeSpan value)
Parameters
Returns
Round(TimeSpan, double, TimeUnit, VerticalDirection)
Returns a TimeSpan value that is rounded either towards negative infinity or positive infinity.
public static TimeSpan Round(this TimeSpan value, double interval, TimeUnit timeUnit, VerticalDirection direction)
Parameters
valueTimeSpanA TimeSpan value to be rounded.
intervaldoubleThe double value that in combination with
timeUnitspecifies the rounding ofvalue.timeUnitTimeUnitOne of the enumeration values that specifies the time unit of
interval.directionVerticalDirectionOne of the enumeration values that specifies the direction of the rounding.
Returns
Exceptions
- ArgumentOutOfRangeException
directionis an invalid enumeration value.
Round(TimeSpan, TimeSpan, VerticalDirection)
Returns a TimeSpan value that is rounded either towards negative infinity or positive infinity.
public static TimeSpan Round(this TimeSpan value, TimeSpan interval, VerticalDirection direction)
Parameters
valueTimeSpanA TimeSpan value to be rounded.
intervalTimeSpanThe TimeSpan value that specifies the rounding of
value.directionVerticalDirectionOne of the enumeration values that specifies the direction of the rounding.
Returns
Exceptions
- ArgumentOutOfRangeException
directionis an invalid enumeration value.