SITL: Use the GPS_LEAPSECOND define

This commit is contained in:
Michael du Breuil 2017-01-10 02:59:02 -07:00 committed by Francisco Ferreira
parent c696137a42
commit d5a5a97a3d
1 changed files with 1 additions and 1 deletions

View File

@ -177,7 +177,7 @@ static void gps_time(uint16_t *time_week, uint32_t *time_week_ms)
{
struct timeval tv;
simulation_timeval(&tv);
const uint32_t epoch = 86400*(10*365 + (1980-1969)/4 + 1 + 6 - 2) - 15;
const uint32_t epoch = 86400*(10*365 + (1980-1969)/4 + 1 + 6 - 2) - (GPS_LEAPSECONDS_MILLIS / 1000ULL);
uint32_t epoch_seconds = tv.tv_sec - epoch;
*time_week = epoch_seconds / (86400*7UL);
uint32_t t_ms = tv.tv_usec / 1000;