RobotRaconteurCompanion.Util.DateTimeUtil

Utility class for working with Robot Raconteur standard times structures.

import RobotRaconteur as RR
RRN = RR.RobotRaconteurNode.s
import RobotRaconteurCompanion as RRC
from RobotRaconeteurCompanion.Util.DateTimeUtil import DateTimeUtil

RRC.RegisterStdRobDefServiceTypes(RRN)

# Create a DateTimeUtil object
dt_util = DateTimeUtil(RRN)

# Create a Robot Raconteur TimeSpec2
now_timespec2 = dt_util.NowTimeSpec()

# Create a Robot Raconteur TimeSpec3
now_timespec3 = dt_util.NowTimeSpec3()

# Create a Robot Raconteur DateTimeUTC
now_datetimeutc = dt_util.NowDateTimeUTC()

DateTimeUtil

class RobotRaconteurCompanion.Util.DateTimeUtil.DateTimeUtil(node=None, client_obj=None)

Utility class to populate Robot Raconteur time structures

Parameters:
  • node (RobotRaconteur.RobotRaconteurNode) – (optional) The Robot Raconteur node to use for parsing. Defaults to RobotRaconteurNode.s

  • client_obj (RobotRaconteur.ClientObject) – (optional) The client object to use for finding types. Defaults to None

FillDeviceTime(device_info, seqno)

Fill a DeviceTime structure with the current time

Parameters:
  • device_info (com.robotraconteur.device.DeviceInfo) – The device info structure to use for the clock UUID

  • seqno (int) – The sequence number to use

Returns:

The DeviceTime structure

Return type:

com.robotraconteur.device.clock.DeviceTime

TimeSpec2Now(device_info=None)

Get the current TimeSpec from the node, stored as TimeSpec2

TimeSpec is based on the performance counter, and is not guaranteed to be synchronized between nodes or with the system real-time clock. It is expected to be close to the system real-time clock, but may drift over time and is guaranteed to remain stable even if the system real-time clock is changed.

Parameters:

device_info (com.robotraconteur.device.DeviceInfo) – (optional) The device info structure to use for the clock UUID. Defaults to None

Returns:

The current TimeSpec as TimeSpec2

Return type:

com.robotraconteur.datetime.TimeSpec2

TimeSpec3Now()

Get the current TimeSpec from the node, stored as TimeSpec3

The TimeSpec3 is a 64-bit integer representing microseconds since the epoch of the real-time clock. It is intended to be a compact representation of the current time that can be used for timestamping data.

TimeSpec is based on the performance counter, and is not guaranteed to be synchronized between nodes or with the system real-time clock. It is expected to be close to the system real-time clock, but may drift over time and is guaranteed to remain stable even if the system real-time clock is changed.

Returns:

The current TimeSpec as TimeSpec3

Return type:

com.robotraconteur.datetime.TimeSpec3

UtcNow(device_info=None)

Get the current DateTimeUTC Time from the node

Parameters:

device_info (com.robotraconteur.device.DeviceInfo) – (optional) The device info structure to use for the clock UUID. Defaults to None

Returns:

The current UTC time

Return type:

com.robotraconteur.datetime.DateTimeUTC