diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-09-29 01:42:45 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-09-29 01:46:53 -0400 |
commit | 4361ec2d89bdf451602d659ddfd0fb9a79c178a2 (patch) | |
tree | af067d1d7614a9e67f449eec933ba3347cde10b0 /timebase.c | |
parent | a77b95b57475c2856707e91b197f8aaa8e5eb407 (diff) | |
download | gpsd-4361ec2d89bdf451602d659ddfd0fb9a79c178a2.tar.gz |
Change gpsd_report to no longer use a global. All regression tests pass.
This is a large, ugly change. But without it we can't troubleshoot the
ICP/IP-source initialization bug properly - colliding definitions of
gpsd_report() were interfering with error reporting early in gpsd runs.
More cleanup work remains to be done, but at least this is working.
Diffstat (limited to 'timebase.c')
-rw-r--r-- | timebase.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -126,7 +126,8 @@ 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(LOG_ERROR, "system time looks bogus, dates may not be reliable.\n"); + gpsd_report(context->debug, LOG_ERROR, + "system time looks bogus, dates may not be reliable.\n"); else { /* we've forced the UTC timezone, so this is actually UTC */ struct tm *now = localtime(&context->start_time); @@ -138,7 +139,8 @@ 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(LOG_INF, "startup at %s (%d)\n", + gpsd_report(context->debug, LOG_INF, + "startup at %s (%d)\n", scr, (int)context->start_time); } } @@ -192,7 +194,8 @@ 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(LOG_WARN, "GPS week rollover makes time %s (%f) invalid\n", + gpsd_report(session->context->debug, LOG_WARN, + "GPS week rollover makes time %s (%f) invalid\n", scr, session->newdata.time); } @@ -213,7 +216,8 @@ timestamp_t gpsd_gpstime_resolve(/*@in@*/struct gps_device_t *session, * to 13 bits. */ if ((int)week < (session->context->gps_week & 0x3ff)) { - gpsd_report(LOG_INF, "GPS week 10-bit rollover detected.\n"); + gpsd_report(session->context->debug, LOG_INF, + "GPS week 10-bit rollover detected.\n"); ++session->context->rollovers; } |