diff options
author | Fred Wright <fw@fwright.net> | 2019-03-20 13:05:10 -0700 |
---|---|---|
committer | Fred Wright <fw@fwright.net> | 2019-03-20 13:20:12 -0700 |
commit | 564200f62f9111609bb95626447a30f57db05ddd (patch) | |
tree | a7b86a6b3ccc2ed1ecb94d03fc9bfe3015c359fd /gpsd.h | |
parent | 91d64f90a5b891fc9e79b0f356747ebbef1d3b89 (diff) | |
download | gpsd-564200f62f9111609bb95626447a30f57db05ddd.tar.gz |
Fix fencepost errors in GPS epoch (mainly comments).
The definition of GPS_EPOCH in gpsd.h is correct, but the comment
specified the incorrect corresponding date, which is 06-Jan-1980, not
06-Jan-1981, which isn't even a Sunday.
The century hack in driver_nmea0183.c establishes a 100-year window
for interpreting two-digit years. For now, the range 1980-2079 is
reasonable, given that the GPS epoch is 06-Jan-1980, and the mention
of wrapping "at" 2080 is consistent with this, but the comment
incorrectly placed the GPS epoch in 1981 (perhaps due to believing the
wrong comment in gpsd.h), and the code was written to wrap *after*
2080, rather than *at* 2080. This would place the window at
1981-2080, which would screw up 1980 (admittedly an unlikely case).
This is mostly about not misleading people reading the code than
actual real-life trouble.
TESTED:
Existing tests pass. A test case for a year of "80" would be needed
to actually verify the fix, though.
Diffstat (limited to 'gpsd.h')
-rw-r--r-- | gpsd.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -151,7 +151,7 @@ enum isgpsstat_t { * choosing this as the cutoff, we'll never reject historical GPS logs * that are actually valid. */ -#define GPS_EPOCH 315964800 /* 6 Jan 1981 00:00:00 UTC */ +#define GPS_EPOCH 315964800 /* 6 Jan 1980 00:00:00 UTC */ /* time constant */ #define SECS_PER_DAY (60*60*24) /* seconds per day */ |