summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-11-27 07:18:31 -0500
committerEric S. Raymond <esr@thyrsus.com>2013-11-27 07:18:31 -0500
commit75af80361c87ce0f76c2ca0e2863b2db245f9a9d (patch)
treea008a82d25594b9ae9ab33475f656eb0186dd10f
parentec7e5895f9f8d49984ff31dcc248088bdcfd0696 (diff)
downloadgpsd-75af80361c87ce0f76c2ca0e2863b2db245f9a9d.tar.gz
Derive new CENTURY_VALID flag in context. Not used yet. No logic changes.
-rw-r--r--driver_nmea0183.c2
-rw-r--r--gpsd.h-tail5
2 files changed, 5 insertions, 2 deletions
diff --git a/driver_nmea0183.c b/driver_nmea0183.c
index 43e576a9..e81bad40 100644
--- a/driver_nmea0183.c
+++ b/driver_nmea0183.c
@@ -767,6 +767,7 @@ static gps_mask_t processGPZDA(int c UNUSED, char *field[],
gpsd_report(session->context->debug, LOG_WARN,
"malformed ZDA day: %s\n", field[2]);
} else {
+ session->context->valid |= CENTURY_VALID;
if (century > session->context->century) {
/*
* This mismatch is almost certainly not due to a GPS week
@@ -786,6 +787,7 @@ static gps_mask_t processGPZDA(int c UNUSED, char *field[],
"ZDA year %d less than clock year, "
"probable GPS week rollover lossage\n",
year);
+ session->context->valid &=~ CENTURY_VALID;
}
session->driver.nmea.date.tm_year = year - 1900;
session->driver.nmea.date.tm_mon = mon - 1;
diff --git a/gpsd.h-tail b/gpsd.h-tail
index 134f5a0f..2601d97c 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -232,10 +232,11 @@ struct gps_device_t;
struct gps_context_t {
int valid; /* member validity flags */
- int debug; /* dehug verbosity level */
- bool readonly; /* if true, never write to device */
#define LEAP_SECOND_VALID 0x01 /* we have or don't need correction */
#define GPS_TIME_VALID 0x02 /* GPS week/tow is valid */
+#define CENTURY_VALID 0x04 /* have received ZDA or 4-digit year */
+ int debug; /* dehug verbosity level */
+ bool readonly; /* if true, never write to device */
/* DGPS status */
int fixcnt; /* count of good fixes seen */
/* timekeeping */