Converting ros::Time to C++ string
How can we convert the result of ros::Time::now()
into std::string
, given that std::string to_string (*)
in C++11 doesn't support this conversion ?
How can we convert the result of ros::Time::now()
into std::string
, given that std::string to_string (*)
in C++11 doesn't support this conversion ?
You probably want to use the ros::Time::now().toSec()
result, which is a double.
http://docs.ros.org/latest/api/rostim...
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.
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2019-11-07 20:33:26 -0500
Seen: 1,469 times
Last updated: Nov 07 '19