summaryrefslogtreecommitdiff
path: root/ppsthread.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-04-01 04:48:11 -0400
committerEric S. Raymond <esr@thyrsus.com>2015-04-01 04:48:11 -0400
commitf35ff45084e8f1d095331c4f4f69698feed782bb (patch)
tree8ad3b157feffd38353b1ecd9d58f34afca7ff66a /ppsthread.c
parent0eb3a85ceb4ed9a70697a952e6f10d7b1e9d29f1 (diff)
downloadgpsd-f35ff45084e8f1d095331c4f4f69698feed782bb.tar.gz
Stop making the assumption that device cycle time is 1 second in ppsthread.c.
Instead, pass out real time of last PPS as it was actually seen. We can then correct it using the device's actual cycle time. The correction currently only works for cycle times that are integral multiples of a second.
Diffstat (limited to 'ppsthread.c')
-rw-r--r--ppsthread.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/ppsthread.c b/ppsthread.c
index 2705779e..16b468a8 100644
--- a/ppsthread.c
+++ b/ppsthread.c
@@ -1080,7 +1080,7 @@ static void *gpsd_ppsmonitor(void *arg)
continue;
}
- /* we have valiidated a goood cycle, mark it */
+ /* we have validated a goood cycle, mark it */
unchanged = 0;
/* offset is the skew from expected to observed pulse time */
struct timespec offset;
@@ -1097,18 +1097,12 @@ static void *gpsd_ppsmonitor(void *arg)
"PPS:%s %.10s categorized %.100s",
thread_context->devicename, edge_str, log);
- /* This innocuous-looking "+ 1" embodies a significant
- * assumption: that GPSes report time to the second over the
- * serial stream *after* emitting PPS for the top of second.
- * Thus, when we see PPS our available report is from the
- * previous cycle and we must increment.
- *
- * FIXME! The GR-601W at 38,400 or faster can send the
+ /* FIXME! The GR-601W at 38,400 or faster can send the
* serial fix before the interrupt event carrying the PPS
* line assertion by about 10 mSec!
*/
- ppstimes.real.tv_sec = (time_t)last_fixtime.real.tv_sec + 1;
+ ppstimes.real.tv_sec = (time_t)last_fixtime.real.tv_sec;
ppstimes.real.tv_nsec = 0; /* need to be fixed for 5Hz */
ppstimes.clock = clock_ts;