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
| Edit this page 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(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 |
|---|---|
| bool |
|
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 |
|---|---|
| bool |
|
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 |
|---|---|
| bool |
|
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 |
|---|---|
| bool |
|
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 |
|---|---|
| bool |
|
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 |
|---|---|
| bool |
|
IsUndefined(TimeSpan?)
Determine if the supplied timeSpan has no value.
Declaration
public static bool IsUndefined(this TimeSpan? timeSpan)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan? | timeSpan | The timespan used to check for a value |
Returns
| Type | Description |
|---|---|
| bool |
|
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 |
|---|---|
| bool |
|
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 |
|---|---|
| bool |
|
Min(TimeSpan, 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. |
| 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. |
Edit this page