Class TimeMsg
ROS builtin_interfaces/Time message.
Implements
Inherited Members
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
WriteTo(IMessageSerializer)
Serializes this message to the given serializer.
Declaration
public void WriteTo(IMessageSerializer serializer)
Parameters
| Type | Name | Description |
|---|---|---|
| IMessageSerializer | serializer | The serializer. |