Struct DiscreteTimeInterval | DOTS Timeline | 0.8.0-preview.1
docs.unity3d.com
    Show / Hide Table of Contents

    Struct DiscreteTimeInterval

    Structure representing a time interval.

    Namespace: Unity.Time
    Syntax
    public struct DiscreteTimeInterval : IEquatable<DiscreteTimeInterval>, IFormattable

    Constructors

    DiscreteTimeInterval(DiscreteTime, DiscreteTime)

    Constructor that takes two time values to create an interval.

    Declaration
    public DiscreteTimeInterval(DiscreteTime time0, DiscreteTime time1)
    Parameters
    Type Name Description
    DiscreteTime time0
    DiscreteTime time1

    Fields

    End

    The ending time of the interval

    Declaration
    public readonly DiscreteTime End
    Field Value
    Type Description
    DiscreteTime

    MaxRange

    The largest representable time interval, contains an invalid duration (due to overflow)

    Declaration
    public static readonly DiscreteTimeInterval MaxRange
    Field Value
    Type Description
    DiscreteTimeInterval

    Start

    The starting time of the interval

    Declaration
    public readonly DiscreteTime Start
    Field Value
    Type Description
    DiscreteTime

    Properties

    Duration

    The duration of the interval

    Declaration
    public DiscreteTime Duration { get; }
    Property Value
    Type Description
    DiscreteTime
    Remarks

    The duration of the interval will be capped at DiscreteTime.MaxValue, so very large intervals may not satisfy end = start + duration

    DurationAsTick

    The duration of the interval, expressed as a unsigned long

    Declaration
    public ulong DurationAsTick { get; }
    Property Value
    Type Description
    UInt64
    Remarks

    Use this version to if the duration is possibly larger than DiscreteTime.MaxValue

    Methods

    Clamp(DiscreteTime)

    Declaration
    public DiscreteTime Clamp(DiscreteTime time)
    Parameters
    Type Name Description
    DiscreteTime time
    Returns
    Type Description
    DiscreteTime

    Contains(DiscreteTime)

    Returns true only if a given time value is inside the interval.

    Declaration
    public bool Contains(DiscreteTime t)
    Parameters
    Type Name Description
    DiscreteTime t
    Returns
    Type Description
    Boolean

    Equals(Object)

    Returns true if the time is equal to a given time, false otherwise.

    Declaration
    public override bool Equals(object o)
    Parameters
    Type Name Description
    Object o
    Returns
    Type Description
    Boolean
    Overrides
    ValueType.Equals(Object)

    Equals(DiscreteTimeInterval)

    Returns true if the same range is represented.

    Declaration
    public bool Equals(DiscreteTimeInterval other)
    Parameters
    Type Name Description
    DiscreteTimeInterval other
    Returns
    Type Description
    Boolean

    GetHashCode()

    Returns a hash code for the time.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32
    Overrides
    ValueType.GetHashCode()

    Overlaps(DiscreteTimeInterval)

    Returns true only if another interval overlaps.

    Declaration
    public bool Overlaps(DiscreteTimeInterval other)
    Parameters
    Type Name Description
    DiscreteTimeInterval other
    Returns
    Type Description
    Boolean

    ToString()

    Returns a string representation of the time.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String
    Overrides
    ValueType.ToString()

    ToString(String, IFormatProvider)

    Returns a string representation of the time using a specified format and culture-specific format information.

    Declaration
    public string ToString(string format, IFormatProvider formatProvider)
    Parameters
    Type Name Description
    String format
    IFormatProvider formatProvider
    Returns
    Type Description
    String
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023