1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-04-10 04:36:44 +00:00

Fix week rollover in RTCM messages

This commit is contained in:
Carles Fernandez 2019-05-08 15:26:53 +02:00
parent 64968fc5f4
commit 1d97fa4e61

View File

@ -3402,6 +3402,13 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double
{
const double gps_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000)); // NOLINT(google-runtime-int)
if (eph.i_GPS_week < 512)
{
boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t);
return p_time;
}
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time;
}
@ -3411,6 +3418,13 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_CNAV_Ephemeris& eph, d
{
const double gps_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000)); // NOLINT(google-runtime-int)
if (eph.i_GPS_week < 512)
{
boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t);
return p_time;
}
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time;
}