summaryrefslogtreecommitdiff
path: root/timebase.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-03-07 11:51:15 -0500
committerEric S. Raymond <esr@thyrsus.com>2015-03-07 11:51:15 -0500
commitdf34a3add8df382eb852a67635c6859ee8cc657f (patch)
treec52183ba41403d093ad1ac971fa45c4ba1289f0c /timebase.c
parent9c49083f2afe799343a610912b0ed404b2ffad05 (diff)
downloadgpsd-df34a3add8df382eb852a67635c6859ee8cc657f.tar.gz
gpsd-report() -> gpsd_log()
This change is done so we can add a "log" hook to the pps_thread_t structure (this is not done yet) and harmonize with the name of the outer logging function. If that name had been left as gpsd_report() there would have been scope for bad confusion with the report_hook member. Also, remove two stray duplicative printf calls from the NMEA2000 driver (drivers shouldn't have printfs!) and fix one typo. This is a step towards factoring out ntplib. For that to happen, the PPS thread code needs to be decoupled from the core session structure. No logic changes. Object compatibility preserved. All regression tests pass.
Diffstat (limited to 'timebase.c')
-rw-r--r--timebase.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/timebase.c b/timebase.c
index 395a3932..c44ed372 100644
--- a/timebase.c
+++ b/timebase.c
@@ -223,8 +223,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(&context->errout, LOG_ERROR,
- "system time looks bogus, dates may not be reliable.\n");
+ gpsd_log(&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 */
struct tm *now = localtime(&context->start_time);
@@ -236,9 +236,9 @@ 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, LOG_INF,
- "startup at %s (%d)\n",
- scr, (int)context->start_time);
+ gpsd_log(&context->errout, LOG_INF,
+ "startup at %s (%d)\n",
+ scr, (int)context->start_time);
}
}
@@ -291,9 +291,9 @@ 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, LOG_WARN,
- "GPS week rollover makes time %s (%f) invalid\n",
- scr, session->newdata.time);
+ gpsd_log(&session->context->errout, LOG_WARN,
+ "GPS week rollover makes time %s (%f) invalid\n",
+ scr, session->newdata.time);
}
return t;
@@ -310,16 +310,16 @@ 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, LOG_WARN,
- "century rollover detected.\n");
+ gpsd_log(&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, LOG_WARN,
- "ZDA year less than clock year, "
- "probable GPS week rollover lossage\n");
+ gpsd_log(&session->context->errout, LOG_WARN,
+ "ZDA year less than clock year, "
+ "probable GPS week rollover lossage\n");
session->context->valid &=~ CENTURY_VALID;
}
}
@@ -338,8 +338,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(&session->context->errout, LOG_INF,
- "GPS week 10-bit rollover detected.\n");
+ gpsd_log(&session->context->errout, LOG_INF,
+ "GPS week 10-bit rollover detected.\n");
++session->context->rollovers;
}