[ros-users] ros::time to boost::posix_time::ptime

Lorenz Mösenlechner moesenle at in.tum.de
Tue Jan 24 09:28:21 UTC 2012


Hi,

to submit patches or make feature requests, people normally file a ticket
here:
https://code.ros.org/trac/ros/

Lorenz

On Tue, Jan 24, 2012 at 10:04 AM, Markus Bader <markus.bader at tuwien.ac.at>wrote:

> Hi
>
> Thanks to Lorenz and William for the quick answer
> It would be nice to enhance the code for a back conversion back to
> ros::Time who is in charge for that?
> The downside would be that the resolution will be reduced if boost
> time is compiled for six fraction digits (mirosec).
>
> void fromBoost ( const boost::posix_time::ptime &src, ros::Time &des )
> const {
>    boost::posix_time::time_duration diff = src -
> boost::posix_time::from_time_t(0);
>    des.sec = diff.total_seconds();
> #if defined(BOOST_DATE_TIME_HAS_NANOSECONDS)
>    des.nsec = diff.fractional_seconds();
> #else
>    #warning boost time uses only microseconds nanoseconds are lost
>    des.nsec = diff.fractional_seconds()*1000;
> #endif
> }
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
>


-- 
Lorenz Mösenlechner            | moesenle at in.tum.de
Technische Universität München | Karlstraße 45
80335 München                  | Germany
http://ias.cs.tum.edu/         | Tel: +49 (89) 289-26910
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20120124/d7a606e4/attachment-0004.html>


More information about the ros-users mailing list