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

Revision history [back]

Something like this should work:

boost::posix_time::ptime posix_time = ros::Time::now().toBoost();
std::string iso_time_str = boost::posix_time::to_iso_extended_string(posix_time)

Is it the ISO you are looking for? (Didn't test so please double-check syntax)

Reference: http://www.boost.org/doc/libs/1_63_0/doc/html/date_time/posix_time.html

Something like this should work:

#include "boost/date_time/posix_time/posix_time.hpp"

boost::posix_time::ptime posix_time = ros::Time::now().toBoost();
std::string iso_time_str = boost::posix_time::to_iso_extended_string(posix_time)

Is it the ISO you are looking for? (Didn't test so please double-check syntax)

Reference: http://www.boost.org/doc/libs/1_63_0/doc/html/date_time/posix_time.html

Something like this should work:

#include "boost/date_time/posix_time/posix_time.hpp"

boost::posix_time::ptime posix_time my_posix_time = ros::Time::now().toBoost();
std::string iso_time_str = boost::posix_time::to_iso_extended_string(posix_time)
boost::posix_time::to_iso_extended_string(my_posix_time)

Is it the ISO you are looking for? (Didn't test so please double-check syntax)syntax and result)

Reference: http://www.boost.org/doc/libs/1_63_0/doc/html/date_time/posix_time.html