mirror of https://github.com/ArduPilot/ardupilot
AP_HAL_SITL: Force the simulated gps time to be on valid intervals for u-blox hardware
This commit is contained in:
parent
b8fc524954
commit
287a3367ad
|
@ -162,7 +162,9 @@ static void gps_time(uint16_t *time_week, uint32_t *time_week_ms)
|
|||
const uint32_t epoch = 86400*(10*365 + (1980-1969)/4 + 1 + 6 - 2) - 15;
|
||||
uint32_t epoch_seconds = tv.tv_sec - epoch;
|
||||
*time_week = epoch_seconds / (86400*7UL);
|
||||
*time_week_ms = (epoch_seconds % (86400*7UL))*1000 + tv.tv_usec/1000;
|
||||
uint32_t t_ms = tv.tv_usec / 1000;
|
||||
// round time to nearest 200ms
|
||||
*time_week_ms = (epoch_seconds % (86400*7UL))*1000 + ((t_ms/200) * 200);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue