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     //return (((uint64_t)src.sec) * (uint64_t)10000000) + ((uint64_t)116444736*1000000000);
00016     des = mrpt::system::time_tToTimestamp((time_t) src.sec) + src.nsec/100;
00017     // printf("nsec    %" PRIu64 "\n", des);
00018 }
00019 
00025 inline void convert(const mrpt::system::TTimeStamp &src, ros::Time &des) {
00026   des.sec = ((uint64_t)src)  / ((uint64_t) 10000000) - (((uint64_t) 116444736) * ((uint64_t) 100));
00027   des.nsec = ((uint64_t)src)  % ((uint64_t) 10000000) * 100;
00028   //printf("ros.sec       %" PRIu32 "\n", des.sec);
00029   //printf("ros.nsec      %" PRIu32 "\n", des.nsec);
00030 }
00031 
00032 }; //namespace mrpt_bridge
00033 
00034 #endif


mrpt_bridge
Author(s):
autogenerated on Tue Aug 5 2014 10:58:06