Table of Contents

Class TimeSpanExtensions

Namespace
Akka.TestKit.Internal
Assembly
Akka.TestKit.dll

This class contains extension methods used to simplify working with TimeSpans. Note! Part of internal API. Breaking changes may occur without notice. Use at own risk.

public static class TimeSpanExtensions
Inheritance
TimeSpanExtensions
Inherited Members

Methods

EnsureIsPositiveFinite(TimeSpan, string)

Throws an ArgumentException if the timeSpan is not 0 or greater. Note! Part of internal API. Breaking changes may occur without notice. Use at own risk.

public static void EnsureIsPositiveFinite(this TimeSpan timeSpan, string parameterName)

Parameters

timeSpan TimeSpan

The timespan used for comparison.

parameterName string

The name of the timespan.

Exceptions

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)

public static bool IsInfinite(this TimeSpan? timeSpan)

Parameters

timeSpan TimeSpan?

The timespan used to check the number of ticks.

Returns

bool

true if the given timespan has a negative number of ticks; otherwise, false.

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)

public static bool IsInfinite(this TimeSpan timeSpan)

Parameters

timeSpan TimeSpan

The timespan used to check the number of ticks.

Returns

bool

true if the given timespan has a negative number of ticks; otherwise, false.

IsInfiniteTimeout(TimeSpan?)

Determine if the supplied timeSpan is equal to InfiniteTimeSpan.

public static bool IsInfiniteTimeout(this TimeSpan? timeSpan)

Parameters

timeSpan TimeSpan?

The timespan used for comparison.

Returns

bool

true if the given timespan is equal to InfiniteTimeSpan; otherwise, false.

IsInfiniteTimeout(TimeSpan)

Determine if the supplied timeSpan is equal to InfiniteTimeSpan.

public static bool IsInfiniteTimeout(this TimeSpan timeSpan)

Parameters

timeSpan TimeSpan

The timespan used for comparison.

Returns

bool

true if the given timespan is equal to InfiniteTimeSpan; otherwise, false.

IsPositiveFinite(TimeSpan?)

Determine if the supplied timeSpan has one or more ticks.

public static bool IsPositiveFinite(this TimeSpan? timeSpan)

Parameters

timeSpan TimeSpan?

The timespan used to check the number of ticks.

Returns

bool

true if the given timespan has one or more ticks; otherwise, false.

IsPositiveFinite(TimeSpan)

Determine if the supplied timeSpan has one or more ticks.

public static bool IsPositiveFinite(this TimeSpan timeSpan)

Parameters

timeSpan TimeSpan

The timespan used to check the number of ticks.

Returns

bool

true if the given timespan has one or more ticks; otherwise, false.

IsUndefined(TimeSpan?)

Determine if the supplied timeSpan has no value.

public static bool IsUndefined(this TimeSpan? timeSpan)

Parameters

timeSpan TimeSpan?

The timespan used to check for a value

Returns

bool

true if the given timespan has no value; otherwise, false.

IsZero(TimeSpan?)

Determine if the supplied timeSpan has zero ticks.

public static bool IsZero(this TimeSpan? timeSpan)

Parameters

timeSpan TimeSpan?

The timespan used to check the number of ticks.

Returns

bool

true if the given timespan has zero ticks; otherwise, false.

IsZero(TimeSpan)

Determine if the supplied timeSpan has zero ticks.

public static bool IsZero(this TimeSpan timeSpan)

Parameters

timeSpan TimeSpan

The timespan used to check the number of ticks.

Returns

bool

true if the given timespan has zero ticks; otherwise, false.

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.

public static TimeSpan Min(this TimeSpan a, TimeSpan? b)

Parameters

a TimeSpan

The first timespan used for comparison.

b TimeSpan?

The second timespan used for comparison

Returns

TimeSpan

The timespan with the least amount of ticks between the two given timespans.