Couchbase .NET SDK | 3.7.2
Search Results for

    Show / Hide Table of Contents

    Class TimeSpanExtensions

    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: Couchbase.Utils
    Assembly: Couchbase.NetClient.dll
    Syntax
    public static class TimeSpanExtensions

    Methods

    | Edit this page View Source

    GetSeconds(TimeSpan)

    Retrieves the number of seconds expressed in a TimeSpan as an uint.

    Declaration
    public static uint GetSeconds(this TimeSpan timeSpan)
    Parameters
    Type Name Description
    TimeSpan timeSpan

    The timespan.

    Returns
    Type Description
    uint

    An uint that is the total number of seconds in the TimeSpan.

    | Edit this page View Source

    ToTtl(TimeSpan)

    Converts a TimeSpan into an uint correctly representing a Time-To-Live, that is expressed in seconds. Durations strictly bigger than 30 days are converted to a unix-syle timestamp (seconds since the Epoch), as described in the couchbase TTL documentation.

    Declaration
    public static uint ToTtl(this TimeSpan duration)
    Parameters
    Type Name Description
    TimeSpan duration
    Returns
    Type Description
    uint

    The TTL, expressed as a suitable uint.

    | Edit this page View Source

    ToTtl(uint)

    Converts a duration expressed as milliseconds to a unix-based TTL.

    Declaration
    public static uint ToTtl(this uint duration)
    Parameters
    Type Name Description
    uint duration

    Milliseconds to use as TTL.

    Returns
    Type Description
    uint

    The TTL, expressed as a unix-based TTL in milliseconds.

    • Edit this page
    • View Source
    In this article
    Back to top © 2025 Couchbase, Inc.