Current Time
R2026bLibraries:
ROS Toolbox /
ROS 2
Description
The Current Time block outputs the current ROS 2 time. ROS 2 time is based
on the system clock of your computer or the /clock topic being published on
the ROS 2 network.
If the use_sim_time ROS 2 parameter is set to true,
the block returns the simulation time published on the /clock topic.
Otherwise, the block returns the system time of your machine.
Examples
Ports
Output
Parameters
Programmatic Use: Add Block
To add the block programmatically, use the add_block function with one of these library block paths as the source.
"ros2lib/Current Time"
Example: add_block("ros2lib/Current Time","myModel/myBlock",MakeNameUnique="on")
Extended Capabilities
Version History
Introduced in R2022b

