]> git.mxchange.org Git - flightgear.git/blobdiff - utils/GPSsmooth/gps.cxx
Allow setting of NED velocities.
[flightgear.git] / utils / GPSsmooth / gps.cxx
index 54bdeb48f55fe5ed70432ec75e12d158ab8ca671..fd783398f6ec197a045ba25b1bcd02b20b7dcc6f 100644 (file)
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <iostream>
 
 #include <simgear/constants.h>
@@ -6,8 +10,8 @@
 
 #include "gps.hxx"
 
-SG_USING_STD(cout);
-SG_USING_STD(endl);
+using std::cout;
+using std::endl;
 
 
 GPSTrack::GPSTrack() {};
@@ -42,7 +46,7 @@ int GPSTrack::load( const string &file ) {
         double raw, min;
 
         if ( tokens[0] == "$GPRMC" && tokens.size() == 13 ) {
-            int raw_time = atoi(tokens[1].c_str());
+            double raw_time = atof(tokens[1].c_str());
             GPSTime gps_time = GPSTime( raw_time );
             if ( (gps_time.get_time() > p.gps_time.get_time()) &&
                  (p.gps_time.get_time() > 1.0) )
@@ -78,9 +82,9 @@ int GPSTrack::load( const string &file ) {
             p.course_true = atof( tokens[8].c_str() ) * SGD_DEGREES_TO_RADIANS;
 
         } else if ( tokens[0] == "$GPGGA" && tokens.size() == 15 ) {
-            int raw_time = atoi(tokens[1].c_str());
+            double raw_time = atof(tokens[1].c_str());
             GPSTime gps_time = GPSTime( raw_time );
-            if ( (gps_time.get_time() != p.gps_time.get_time()) &&
+            if ( fabs(gps_time.get_time() - p.gps_time.get_time()) > 0.0001 &&
                  (p.gps_time.get_time() > 1.0) ) {
                 // new data cycle store last data before continuing
                 data.push_back( p );