summaryrefslogtreecommitdiff
path: root/timebase.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2014-08-27 16:42:04 -0400
committerEric S. Raymond <esr@thyrsus.com>2014-08-27 16:42:04 -0400
commit995976ab06a8f688343b8fec87e1305e2d5ee80e (patch)
tree104bf6b57b68676529409f4374cc5881b07b1e7b /timebase.c
parent6203e5b8fcac9d78ea54b7b3c53cb8d084e8a219 (diff)
downloadgpsd-995976ab06a8f688343b8fec87e1305e2d5ee80e.tar.gz
The big leap. Most instances of gpsd_report are replaced...
...with calls to gps_notify(), which indirects to its output method through a slot in an errout structure. Usually the errout structure lives inside the session context, but because struct errout_t is its own thing this does not have to be the case. One large clique of gpsd_notify() calls, in packet.c and isgps.c, looks at a struct errout_t copy in a lexer control block This change is not complete. Remnant gpsd_report calls need to be changed, and gpsmon needs to be tweaked so that the struct_error_t in its context is a non-defaukt hook updating the cuses display rather than simply dumping to stderr. Also the report label functionality needs to be added. All regression tests pass.
Diffstat (limited to 'timebase.c')
-rw-r--r--timebase.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/timebase.c b/timebase.c
index ec80f9f3..d32f886e 100644
--- a/timebase.c
+++ b/timebase.c
@@ -222,7 +222,7 @@ void gpsd_time_init(struct gps_context_t *context, time_t starttime)
context->rollovers = (int)((context->start_time-GPS_EPOCH) / GPS_ROLLOVER);
if (context->start_time < GPS_EPOCH)
- gpsd_report(context->errout.debug, LOG_ERROR,
+ gpsd_notify(&context->errout, LOG_ERROR,
"system time looks bogus, dates may not be reliable.\n");
else {
/* we've forced the UTC timezone, so this is actually UTC */
@@ -235,7 +235,7 @@ void gpsd_time_init(struct gps_context_t *context, time_t starttime)
now->tm_year += 1900;
context->century = now->tm_year - (now->tm_year % 100);
(void)unix_to_iso8601((timestamp_t)context->start_time, scr, sizeof(scr));
- gpsd_report(context->errout.debug, LOG_INF,
+ gpsd_notify(&context->errout, LOG_INF,
"startup at %s (%d)\n",
scr, (int)context->start_time);
}
@@ -290,7 +290,7 @@ timestamp_t gpsd_utc_resolve(/*@in@*/struct gps_device_t *session)
if (session->newdata.time < (timestamp_t)session->context->start_time) {
char scr[128];
(void)unix_to_iso8601(session->newdata.time, scr, sizeof(scr));
- gpsd_report(session->context->errout.debug, LOG_WARN,
+ gpsd_notify(&session->context->errout, LOG_WARN,
"GPS week rollover makes time %s (%f) invalid\n",
scr, session->newdata.time);
}
@@ -309,14 +309,14 @@ void gpsd_century_update(/*@in@*/struct gps_device_t *session, int century)
* certainly it means that a century mark has passed while
* gpsd was running, and we should trust the new ZDA year.
*/
- gpsd_report(session->context->errout.debug, LOG_WARN,
+ gpsd_notify(&session->context->errout, LOG_WARN,
"century rollover detected.\n");
session->context->century = century;
} else if (session->context->start_time >= GPS_EPOCH && century < session->context->century) {
/*
* This looks like a GPS week-counter rollover.
*/
- gpsd_report(session->context->errout.debug, LOG_WARN,
+ gpsd_notify(&session->context->errout, LOG_WARN,
"ZDA year less than clock year, "
"probable GPS week rollover lossage\n");
session->context->valid &=~ CENTURY_VALID;
@@ -337,7 +337,7 @@ timestamp_t gpsd_gpstime_resolve(/*@in@*/struct gps_device_t *session,
* to 13 bits.
*/
if ((int)week < (session->context->gps_week & 0x3ff)) {
- gpsd_report(session->context->errout.debug, LOG_INF,
+ gpsd_notify(&session->context->errout, LOG_INF,
"GPS week 10-bit rollover detected.\n");
++session->context->rollovers;
}