summaryrefslogtreecommitdiff
path: root/timebase.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-01-15 06:02:16 -0500
committerEric S. Raymond <esr@thyrsus.com>2013-01-15 06:02:16 -0500
commit41bb842a07e24c074c30f4d169292b72eea49115 (patch)
tree078b664b0a93334cbe5725b13980a268615aae84 /timebase.c
parent8d609c2584b70a77e6d7a524b260d992fff94268 (diff)
downloadgpsd-41bb842a07e24c074c30f4d169292b72eea49115.tar.gz
Forcing UTC lets us simplify some code. All regression tests pass.
Diffstat (limited to 'timebase.c')
-rw-r--r--timebase.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/timebase.c b/timebase.c
index a3378bc5..6723081b 100644
--- a/timebase.c
+++ b/timebase.c
@@ -110,6 +110,7 @@ void gpsd_time_init(struct gps_context_t *context, time_t starttime)
if (context->start_time < GPS_EPOCH)
gpsd_report(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);
char scr[128];
/*
@@ -170,13 +171,8 @@ timestamp_t gpsd_utc_resolve(/*@in@*/struct gps_device_t *session)
/*
* If the GPS is reporting a time from before the daemon started, we've
* had a rollover event while the daemon was running.
- *
- * The reason for the 12-hour slop is that our recorded start time is local,
- * but GPSes deliver time as though in UTC. This test could be exact if we
- * counted on knowing our timezone at startup, but since we can't count on
- * knowing location...
*/
- if (session->newdata.time + (12*60*60) < (timestamp_t)session->context->start_time) {
+ 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",