ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

You probably want to use the ros::Time::now().toSec() result, which is a double.

http://docs.ros.org/latest/api/rostime/html/classros_1_1TimeBase.html#ab63e3c9f57032143d4eeac4a7ac272a5

Then you can convert that double to a string with std::string to_string.

You could use strftime to convert the double to many different string formats as well.

http://www.cplusplus.com/reference/ctime/strftime/