docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TimeMsg

    ROS builtin_interfaces/Time message.

    Inheritance
    object
    TimeMsg
    Implements
    IMessage
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.SimulationPro.Foundation.BuiltinInterfacesMessages
    Assembly: Unity.SimulationPro.Foundation.dll
    Syntax
    [Serializable]
    public class TimeMsg : IMessage

    Constructors

    TimeMsg()

    Initializes a new TimeMsg instance.

    Declaration
    public TimeMsg()

    TimeMsg(int, uint)

    Initializes a new TimeMsg instance with the specified ROS2-style time components.

    Declaration
    public TimeMsg(int sec, uint nanosec)
    Parameters
    Type Name Description
    int sec

    Whole seconds since the epoch.

    uint nanosec

    Additional nanoseconds past the seconds value.

    TimeMsg(uint, uint)

    Initializes a new TimeMsg instance with the specified time components.

    Declaration
    public TimeMsg(uint secs, uint nsecs)
    Parameters
    Type Name Description
    uint secs

    Whole seconds since the epoch.

    uint nsecs

    Additional nanoseconds past the seconds value.

    Fields

    k_MessageTypeId

    Identifier for this message type.

    Declaration
    public static readonly MessageTypeId k_MessageTypeId
    Field Value
    Type Description
    MessageTypeId

    k_MessageTypeName

    The ROS message type name.

    Declaration
    public const string k_MessageTypeName = "builtin_interfaces/Time"
    Field Value
    Type Description
    string

    nanosec

    Nanoseconds component of the ROS2 time, valid in the range [0, 10^9).

    Declaration
    public uint nanosec
    Field Value
    Type Description
    uint

    sec

    Seconds component of the ROS2 time, valid over all int values.

    Declaration
    public int sec
    Field Value
    Type Description
    int

    Properties

    MessageTypeId

    Gets the unique runtime identifier for this message type.

    Declaration
    public MessageTypeId MessageTypeId { get; }
    Property Value
    Type Description
    MessageTypeId

    MessageTypeName

    The ROS message type name.

    Declaration
    public string MessageTypeName { get; }
    Property Value
    Type Description
    string

    nsecs

    ROS1-compatible accessor for nanosec.

    Declaration
    public uint nsecs { get; set; }
    Property Value
    Type Description
    uint

    secs

    ROS1-compatible accessor for sec as an unsigned integer.

    Declaration
    public uint secs { get; set; }
    Property Value
    Type Description
    uint

    Methods

    Deserialize(IMessageDeserializer)

    Deserializes a TimeMsg from the given deserializer.

    Declaration
    public static TimeMsg Deserialize(IMessageDeserializer deserializer)
    Parameters
    Type Name Description
    IMessageDeserializer deserializer

    The deserializer.

    Returns
    Type Description
    TimeMsg

    A new TimeMsg instance.

    Register()

    Registers this message type with the MessageTypeRegistry.

    Declaration
    [InitializeOnLoadMethod]
    public static void Register()

    ToString()

    Returns a human-readable string representation of this message.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string representation of this instance.

    Overrides
    object.ToString()

    WriteTo(IMessageSerializer)

    Serializes this message to the given serializer.

    Declaration
    public void WriteTo(IMessageSerializer serializer)
    Parameters
    Type Name Description
    IMessageSerializer serializer

    The serializer.

    Implements

    IMessage

    Extension Methods

    ClockHelpers.ToSeconds(TimeMsg)
    MessageExtensions.ToDateTime(TimeMsg)
    MessageExtensions.ToLongTime(TimeMsg)
    MessageExtensions.ToTimestampString(TimeMsg)
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)