From 4bb1872e17a310e591ce32ed26031c12e3872582 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 29 Apr 2019 17:23:09 +0200 Subject: [PATCH 1/2] Fix date in RINEX annotations beyond the rollover --- src/algorithms/PVT/libs/rinex_printer.cc | 37 ++++++++++++++++++++---- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index b9b2c2223..69d678d06 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -11082,8 +11082,16 @@ boost::posix_time::ptime Rinex_Printer::compute_UTC_time(const Gps_Navigation_Me //: idea resolve the ambiguity with the leap second http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm const double utc_t = nav_msg.utc_time(nav_msg.d_TOW); boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((utc_t + 604800 * static_cast(nav_msg.i_GPS_week)) * 1000)); - boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); - return p_time; + if (nav_msg.i_GPS_week > 512) + { + boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t); + return p_time; + } + else + { + boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); + return p_time; + } } @@ -11108,8 +11116,16 @@ boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_Ephemeris& ep // --??? No time correction here, since it will be done in the RINEX processor const double gps_t = obs_time; boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000)); - boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); - return p_time; + if (eph.i_GPS_week > 512) + { + boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t); + return p_time; + } + else + { + boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); + return p_time; + } } @@ -11121,8 +11137,16 @@ boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_CNAV_Ephemeri // --??? No time correction here, since it will be done in the RINEX processor const double gps_t = obs_time; boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000)); - boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); - return p_time; + if (eph.i_GPS_week > 512) + { + boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t); + return p_time; + } + else + { + boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); + return p_time; + } } @@ -11178,6 +11202,7 @@ boost::posix_time::ptime Rinex_Printer::compute_UTC_time(const Glonass_Gnav_Ephe return utc_time; } + double Rinex_Printer::get_leap_second(const Glonass_Gnav_Ephemeris& eph, const double gps_obs_time) { double tod = 0.0; From 16f9e623c11187b1f7c61df9e25a61997aefb601 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 29 Apr 2019 19:04:07 +0200 Subject: [PATCH 2/2] Fix wrong comparison --- src/algorithms/PVT/libs/rinex_printer.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 69d678d06..52f764282 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -11082,7 +11082,7 @@ boost::posix_time::ptime Rinex_Printer::compute_UTC_time(const Gps_Navigation_Me //: idea resolve the ambiguity with the leap second http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm const double utc_t = nav_msg.utc_time(nav_msg.d_TOW); boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((utc_t + 604800 * static_cast(nav_msg.i_GPS_week)) * 1000)); - if (nav_msg.i_GPS_week > 512) + if (nav_msg.i_GPS_week < 512) { boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t); return p_time; @@ -11116,7 +11116,7 @@ boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_Ephemeris& ep // --??? No time correction here, since it will be done in the RINEX processor const double gps_t = obs_time; boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000)); - if (eph.i_GPS_week > 512) + if (eph.i_GPS_week < 512) { boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t); return p_time; @@ -11137,7 +11137,7 @@ boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_CNAV_Ephemeri // --??? No time correction here, since it will be done in the RINEX processor const double gps_t = obs_time; boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000)); - if (eph.i_GPS_week > 512) + if (eph.i_GPS_week < 512) { boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t); return p_time;