mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-11-24 19:14:52 +00:00
Fix week rollover in RTCM messages
This commit is contained in:
@@ -3402,6 +3402,13 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double
|
|||||||
{
|
{
|
||||||
const double gps_t = obs_time;
|
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)
|
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);
|
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||||
return p_time;
|
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;
|
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)
|
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);
|
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||||
return p_time;
|
return p_time;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user