~vcs-imports/gpsd/master

Viewing all changes in revision 13491.

  • Committer: Fred Wright
  • Date: 2019-03-20 20:20:12 UTC
  • Revision ID: git-v1:564200f62f9111609bb95626447a30f57db05ddd
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.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: