time.h
Go to the documentation of this file.
00001 #ifndef MRPT_BRIDGE_TIME_H
00002 #define MRPT_BRIDGE_TIME_H
00003 
00004 #include <mrpt/system/datetime.h>
00005 #include <ros/time.h>
00006 
00007 namespace mrpt_bridge
00008 {
00014 inline void convert(const ros::Time& src, mrpt::system::TTimeStamp& des)
00015 {
00016         // return (((uint64_t)src.sec) * (uint64_t)10000000) +
00017         // ((uint64_t)116444736*1000000000);
00018         des = mrpt::system::time_tToTimestamp((time_t)src.sec) + src.nsec / 100;
00019         // printf("nsec    %" PRIu64 "\n", des);
00020 }
00021 
00027 inline void convert(const mrpt::system::TTimeStamp& src, ros::Time& des)
00028 {
00029         des.sec = ((uint64_t)src) / ((uint64_t)10000000) -
00030                           (((uint64_t)116444736) * ((uint64_t)100));
00031         des.nsec = ((uint64_t)src) % ((uint64_t)10000000) * 100;
00032         // printf("ros.sec       %" PRIu32 "\n", des.sec);
00033         // printf("ros.nsec      %" PRIu32 "\n", des.nsec);
00034 }
00035 
00036 };  // namespace mrpt_bridge
00037 
00038 #endif


mrpt_bridge
Author(s): Markus Bader , Raphael Zack
autogenerated on Fri Apr 27 2018 05:10:54