ros2time
Syntax
Description
returns a
time
= ros2timebuiltin_interfaces/Time
ROS 2 message structure,
time
, with seconds and nanoseconds set to
0
.
returns the current ROS 2 time time
= ros2time(node
,"now")time
within the specified ros2node
object node
. If the
use_sim_time
ROS 2 parameter is set to true
, then
ros2time
returns the simulation time published on the
clock
topic. Otherwise, the function returns the system time of your
machine. If you do not specify an output argument, the function prints the current time
(in seconds) to the screen.
You can use ros2time
to timestamp messages or to measure time in
the ROS 2 network.
returns the system time of your machine, even if ROS publishes simulation time on the
time
= ros2time(node
,"now","system")clock
topic. If you do not specify an output argument, the function
prints the system time (in seconds) to the screen.
System time in ROS follows the UNIX or POSIX time standard. POSIX time is defined as the time that has elapsed since 00:00:00 Coordinated Universal Time (UTC), January 1 1970, not counting leap seconds.
Examples
Input Arguments
Output Arguments
Extended Capabilities
Version History
Introduced in R2022b