There is already a ROS Time to Boost time function, don't know if there is one for the other direction:<div><br></div><div><a href="http://ros.org/doc/electric/api/rostime/html/impl_2time_8h_source.html#l00161">http://ros.org/doc/electric/api/rostime/html/impl_2time_8h_source.html#l00161</a></div>

<div><br></div><div>--</div><div><br clear="all">~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>William Woodall<br>Graduate Software Engineering<br>Auburn University<br><a href="mailto:w@auburn.edu" target="_blank">w@auburn.edu</a><br>

<a href="mailto:wjwwood@gmail.com" target="_blank">wjwwood@gmail.com</a><div><a href="http://williamjwoodall.com" target="_blank">williamjwoodall.com</a><br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</div><br>
<br><br><div class="gmail_quote">On Mon, Jan 23, 2012 at 9:26 AM, Markus Bader <span dir="ltr"><<a href="mailto:markus.bader@tuwien.ac.at">markus.bader@tuwien.ac.at</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi<br>
<br>
ROS is using many boost libs, but has his own time/duration/.. implentation<br>
Would it be possible to add at least a convertion funtion to the boost<br>
time classes<br>
<br>
like:<br>
<br>
boost::posix_time::ptime  rostime2ptime_utc(const ros::Time &t) {<br>
    using namespace boost::posix_time;<br>
    typedef boost::date_time::subsecond_duration<time_duration,1000000000><br>
nanoseconds;<br>
    boost::gregorian::date d(1970, boost::gregorian::Jan, 1);<br>
    ptime  t_utc(d, seconds(t.sec) + nanoseconds(t.nsec));<br>
    return t_utc;<br>
}<br>
<br>
boost::posix_time::ptime  rostime2ptime_local(const ros::Time &t) {<br>
    using namespace boost::posix_time;<br>
    ptime t_utc = rostime2ptime_utc(t);<br>
    ptime t_local =<br>
boost::date_time::c_local_adjustor<ptime>::utc_to_local(t_utc);<br>
    return t_local;<br>
}<br>
<br>
Greetings<br>
Markus<br>
_______________________________________________<br>
ros-users mailing list<br>
<a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
<a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
</blockquote></div><br></div>