|
|
|
@ -179,10 +179,10 @@ static void gps_time(uint16_t *time_week, uint32_t *time_week_ms)
@@ -179,10 +179,10 @@ static void gps_time(uint16_t *time_week, uint32_t *time_week_ms)
|
|
|
|
|
simulation_timeval(&tv); |
|
|
|
|
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 / SEC_PER_WEEK; |
|
|
|
|
*time_week = epoch_seconds / AP_SEC_PER_WEEK; |
|
|
|
|
uint32_t t_ms = tv.tv_usec / 1000; |
|
|
|
|
// round time to nearest 200ms
|
|
|
|
|
*time_week_ms = (epoch_seconds % SEC_PER_WEEK) * MSEC_PER_SEC + ((t_ms/200) * 200); |
|
|
|
|
*time_week_ms = (epoch_seconds % AP_SEC_PER_WEEK) * AP_MSEC_PER_SEC + ((t_ms/200) * 200); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|