Search Results for

    Show / Hide Table of Contents

    Class TimeSpanExtensions

    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.

    Inheritance
    object
    TimeSpanExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.TestKit.Internal
    Assembly: Akka.TestKit.dll
    Syntax
    public static class TimeSpanExtensions

    Methods

    | Edit this page View Source

    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.

    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.

    | Edit this page View Source

    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

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

    | Edit this page View Source

    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

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

    | Edit this page View Source

    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

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

    | Edit this page View Source

    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

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

    | Edit this page View Source

    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

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

    | Edit this page View Source

    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

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

    | Edit this page View Source

    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

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

    | Edit this page View Source

    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

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

    | Edit this page View Source

    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

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

    | Edit this page View Source

    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.

    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET