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

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: User discussions
Subject: Re: [ros-users] ros::time to boost::posix_time::ptime
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 <>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
> 
> https://code.ros.org/mailman/listinfo/ros-users

>
>



-- 
Lorenz Mösenlechner            | 
Technische Universität München | Karlstraße 45
80335 München                  | Germany
http://ias.cs.tum.edu/         | Tel: +49 (89) 289-26910