diff options
author | Gary E. Miller <gem@rellim.com> | 2019-04-24 17:41:14 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2019-04-24 17:41:14 -0700 |
commit | 310a4c007fd50d84b431349b2a9e802e2dab8df5 (patch) | |
tree | fb015098a50c5a3f48304d4b7d44be47bf2dda0b /timebase.c | |
parent | 5e520b1eda5a34e8443d1013a047e0e63c411054 (diff) | |
download | gpsd-310a4c007fd50d84b431349b2a9e802e2dab8df5.tar.gz |
timebase: Rollback 2037+ dates to GPS eopch 1.
Dates past 18-Jan-2038 break 32-bit time_t, and are a while
off from now. So roll the GPS epoch back to 1 when week
is past week 968 in epoch 2 (late in 2037).
This fixes one GREIS regression, and allows the rollback of two
more to their correct date.
All regressions now pass again. Until 2037...
Diffstat (limited to 'timebase.c')
-rw-r--r-- | timebase.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -347,6 +347,12 @@ timestamp_t gpsd_gpstime_resolve(struct gps_device_t *session, ++session->context->rollovers; } + if ((967 < week) && (2 == session->context->rollovers)) { + /* week 968 in GPS epoch 2, is 2038-01-18. + * This hits time_t rollover bug. + * Must be a regression from epoch 1 */ + session->context->rollovers = 1; + } /* * This guard copes with both conventional GPS weeks and the "extended" * 15-or-16-bit version with no wraparound that appears in Zodiac |