Class TimeSpanExtensions
This class contains extension methods used to simplify working with TimeSpans.
Inherited Members
Namespace: Akka.TestKit.Internal
Assembly: Akka.TestKit.dll
Syntax
public static class TimeSpanExtensions
Methods
| Improve this Doc View SourceEnsureIsPositiveFinite(TimeSpan, String)
Throws an ArgumentException if the timeSpan
is not 0 or greater.
Declaration
public static void EnsureIsPositiveFinite(this TimeSpan timeSpan, string parameterName)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeSpan | The timespan used for comparison. |
String | parameterName | The name of the timespan. |
Exceptions
Type | Condition |
---|---|
ArgumentException | This exception is thrown when the given timespan has zero or less ticks. |
IsInfinite(Nullable<TimeSpan>)
Determine if the supplied timeSpan
has a negative number of ticks.
note
This is a relaxed definition of a TimeSpan. For a stricter definition, use IsInfiniteTimeout(TimeSpan)
Declaration
public static bool IsInfinite(this TimeSpan? timeSpan)
Parameters
Type | Name | Description |
---|---|---|
Nullable<TimeSpan> | timeSpan | The timespan used to check the number of ticks. |
Returns
Type | Description |
---|---|
Boolean |
|
IsInfinite(TimeSpan)
Determine if the supplied timeSpan
has a negative number of ticks.
note
This is a relaxed definition of a TimeSpan. For a stricter definition, use IsInfiniteTimeout(TimeSpan)
Declaration
public static bool IsInfinite(this TimeSpan timeSpan)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeSpan | The timespan used to check the number of ticks. |
Returns
Type | Description |
---|---|
Boolean |
|
IsInfiniteTimeout(Nullable<TimeSpan>)
Determine if the supplied timeSpan
is equal to InfiniteTimeSpan.
Declaration
public static bool IsInfiniteTimeout(this TimeSpan? timeSpan)
Parameters
Type | Name | Description |
---|---|---|
Nullable<TimeSpan> | timeSpan | The timespan used for comparison. |
Returns
Type | Description |
---|---|
Boolean |
|
IsInfiniteTimeout(TimeSpan)
Determine if the supplied timeSpan
is equal to InfiniteTimeSpan.
Declaration
public static bool IsInfiniteTimeout(this TimeSpan timeSpan)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeSpan | The timespan used for comparison. |
Returns
Type | Description |
---|---|
Boolean |
|
IsPositiveFinite(Nullable<TimeSpan>)
Determine if the supplied timeSpan
has one or more ticks.
Declaration
public static bool IsPositiveFinite(this TimeSpan? timeSpan)
Parameters
Type | Name | Description |
---|---|---|
Nullable<TimeSpan> | timeSpan | The timespan used to check the number of ticks. |
Returns
Type | Description |
---|---|
Boolean |
|
IsPositiveFinite(TimeSpan)
Determine if the supplied timeSpan
has one or more ticks.
Declaration
public static bool IsPositiveFinite(this TimeSpan timeSpan)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeSpan | The timespan used to check the number of ticks. |
Returns
Type | Description |
---|---|
Boolean |
|
IsUndefined(Nullable<TimeSpan>)
Determine if the supplied timeSpan
has no value.
Declaration
public static bool IsUndefined(this TimeSpan? timeSpan)
Parameters
Type | Name | Description |
---|---|---|
Nullable<TimeSpan> | timeSpan | The timespan used to check for a value |
Returns
Type | Description |
---|---|
Boolean |
|
IsZero(Nullable<TimeSpan>)
Determine if the supplied timeSpan
has zero ticks.
Declaration
public static bool IsZero(this TimeSpan? timeSpan)
Parameters
Type | Name | Description |
---|---|---|
Nullable<TimeSpan> | timeSpan | The timespan used to check the number of ticks. |
Returns
Type | Description |
---|---|
Boolean |
|
IsZero(TimeSpan)
Determine if the supplied timeSpan
has zero ticks.
Declaration
public static bool IsZero(this TimeSpan timeSpan)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeSpan | The timespan used to check the number of ticks. |
Returns
Type | Description |
---|---|
Boolean |
|
Min(TimeSpan, Nullable<TimeSpan>)
Compares two supplied timespans and returns the timespan with the least amount of positive ticks.
If b
is null
it's treated as
undefined, and a
is returned.
Declaration
public static TimeSpan Min(this TimeSpan a, TimeSpan? b)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | a | The first timespan used for comparison. |
Nullable<TimeSpan> | b | The second timespan used for comparison |
Returns
Type | Description |
---|---|
TimeSpan | The timespan with the least amount of ticks between the two given timespans. |