Show / Hide Table of Contents

    Class TimeSpanExtensions

    Extension methods for the System.TimeSpan structure.

    Inheritance
    System.Object
    TimeSpanExtensions
    Namespace: Cuemon
    Assembly: Cuemon.Core.dll
    Syntax
    public static class TimeSpanExtensions

    Fields

    | Improve this Doc

    TicksPerMicrosecond

    Represents the number of ticks in 1 microsecond. This field is constant.

    Declaration
    public const double TicksPerMicrosecond = 10
    Field Value
    Type Description
    System.Double
    | Improve this Doc

    TicksPerNanosecond

    Represents the number of ticks in 1 nanosecond. This field is constant.

    Declaration
    public const double TicksPerNanosecond = 0.01
    Field Value
    Type Description
    System.Double

    Methods

    | Improve this Doc

    Ceiling(TimeSpan, Double, TimeUnit)

    Returns a System.TimeSpan value that is rounded towards positive infinity.

    Declaration
    public static TimeSpan Ceiling(this TimeSpan value, double interval, TimeUnit timeUnit)
    Parameters
    Type Name Description
    System.TimeSpan value

    A System.TimeSpan value to be rounded.

    System.Double interval

    The System.Double value that in combination with timeUnit specifies the rounding of value.

    TimeUnit timeUnit

    One of the enumeration values that specifies the time unit of interval.

    Returns
    Type Description
    System.TimeSpan

    A System.TimeSpan value that is rounded towards positive infinity.

    | Improve this Doc

    Ceiling(TimeSpan, TimeSpan)

    Returns a System.TimeSpan value that is rounded towards positive infinity.

    Declaration
    public static TimeSpan Ceiling(this TimeSpan value, TimeSpan interval)
    Parameters
    Type Name Description
    System.TimeSpan value

    A System.TimeSpan value to be rounded.

    System.TimeSpan interval

    The System.TimeSpan value that specifies the rounding of value.

    Returns
    Type Description
    System.TimeSpan

    A System.TimeSpan value that is rounded towards positive infinity.

    | Improve this Doc

    Floor(TimeSpan, Double, TimeUnit)

    Returns a System.TimeSpan value that is rounded towards negative infinity.

    Declaration
    public static TimeSpan Floor(this TimeSpan value, double interval, TimeUnit timeUnit)
    Parameters
    Type Name Description
    System.TimeSpan value

    A System.TimeSpan value to be rounded.

    System.Double interval

    The System.Double value that in combination with timeUnit specifies the rounding of value.

    TimeUnit timeUnit

    One of the enumeration values that specifies the time unit of interval.

    Returns
    Type Description
    System.TimeSpan

    A System.TimeSpan value that is rounded towards negative infinity.

    | Improve this Doc

    Floor(TimeSpan, TimeSpan)

    Returns a System.TimeSpan value that is rounded towards negative infinity.

    Declaration
    public static TimeSpan Floor(this TimeSpan value, TimeSpan interval)
    Parameters
    Type Name Description
    System.TimeSpan value

    A System.TimeSpan value to be rounded.

    System.TimeSpan interval

    The System.TimeSpan value that specifies the rounding of value.

    Returns
    Type Description
    System.TimeSpan

    A System.TimeSpan value that is rounded towards negative infinity.

    | Improve this Doc

    GetMicroseconds(TimeSpan)

    Gets the microseconds of the time interval represented by the specified System.TimeSpan structure.

    Declaration
    public static int GetMicroseconds(this TimeSpan ts)
    Parameters
    Type Name Description
    System.TimeSpan ts

    The System.TimeSpan to extend with a microseconds component.

    Returns
    Type Description
    System.Int32

    The millisecond component by the specified System.TimeSpan structure. The return value ranges from -999 through 999.

    | Improve this Doc

    GetNanoseconds(TimeSpan)

    Gets the nanoseconds of the time interval represented by the specified System.TimeSpan structure.

    Declaration
    public static int GetNanoseconds(this TimeSpan ts)
    Parameters
    Type Name Description
    System.TimeSpan ts

    The System.TimeSpan to extend with a nanoseconds component.

    Returns
    Type Description
    System.Int32

    The nanoseconds component by the specified System.TimeSpan structure. The return value ranges from -999 through 999.

    | Improve this Doc

    GetTotalMicroseconds(TimeSpan)

    Gets the total number of microseconds represented by the specified System.TimeSpan structure.

    Declaration
    public static double GetTotalMicroseconds(this TimeSpan ts)
    Parameters
    Type Name Description
    System.TimeSpan ts

    The System.TimeSpan to extend.

    Returns
    Type Description
    System.Double

    The total number of microseconds represented by the specified System.TimeSpan structure.

    | Improve this Doc

    GetTotalNanoseconds(TimeSpan)

    Gets the total number of nanoseconds represented by the specified System.TimeSpan structure.

    Declaration
    public static double GetTotalNanoseconds(this TimeSpan ts)
    Parameters
    Type Name Description
    System.TimeSpan ts

    The System.TimeSpan to extend.

    Returns
    Type Description
    System.Double

    The total number of nanoseconds represented by the specified System.TimeSpan structure.

    | Improve this Doc

    Round(TimeSpan, Double, TimeUnit, VerticalDirection)

    Returns a System.TimeSpan value that is rounded either towards negative infinity or positive infinity.

    Declaration
    public static TimeSpan Round(this TimeSpan value, double interval, TimeUnit timeUnit, VerticalDirection direction)
    Parameters
    Type Name Description
    System.TimeSpan value

    A System.TimeSpan value to be rounded.

    System.Double interval

    The System.Double value that in combination with timeUnit specifies the rounding of value.

    TimeUnit timeUnit

    One of the enumeration values that specifies the time unit of interval.

    VerticalDirection direction

    One of the enumeration values that specifies the direction of the rounding.

    Returns
    Type Description
    System.TimeSpan

    A System.TimeSpan value that is rounded either towards negative infinity or positive infinity.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    direction is an invalid enumeration value.

    | Improve this Doc

    Round(TimeSpan, TimeSpan, VerticalDirection)

    Returns a System.TimeSpan value that is rounded either towards negative infinity or positive infinity.

    Declaration
    public static TimeSpan Round(this TimeSpan value, TimeSpan interval, VerticalDirection direction)
    Parameters
    Type Name Description
    System.TimeSpan value

    A System.TimeSpan value to be rounded.

    System.TimeSpan interval

    The System.TimeSpan value that specifies the rounding of value.

    VerticalDirection direction

    One of the enumeration values that specifies the direction of the rounding.

    Returns
    Type Description
    System.TimeSpan

    A System.TimeSpan value that is rounded either towards negative infinity or positive infinity.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    direction is an invalid enumeration value.

    • Improve this Doc
    • View Source
    Back to top Copyright 2008-2018 Weubphoria. All rights reserved.
    Generated by DocFX