utils.h
Go to the documentation of this file.
00001 #ifndef UBLOX_GPS_UTILS_H
00002 #define UBLOX_GPS_UTILS_H
00003 
00004 #include <math.h>
00005 #include <time.h>
00006 #include "ublox_msgs/NavPVT.h"
00007 
00008 extern "C" {
00009   #include "ublox_gps/mkgmtime.h"
00010 }
00011 
00015 template<typename NavPVT>
00016 long toUtcSeconds(const NavPVT& msg) {
00017   // Create TM struct for mkgmtime
00018   struct tm time = {0};
00019   time.tm_year = msg.year - 1900; 
00020   time.tm_mon = msg.month - 1; 
00021   time.tm_mday = msg.day;
00022   time.tm_hour = msg.hour;   
00023   time.tm_min = msg.min; 
00024   time.tm_sec = msg.sec;
00025   // C++ STL doesn't have a mkgmtime (though other libraries do)
00026   // STL mktime converts date/time to seconds in local time 
00027   // A modified version of code external library is used for mkgmtime
00028   return mkgmtime(&time);
00029 }
00030 
00031 #endif


ublox_gps
Author(s): Johannes Meyer
autogenerated on Fri Jun 14 2019 19:26:13