diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2014-08-21 18:30:23 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2014-08-21 18:30:23 -0400 |
commit | a006eef564b7a6bab2c8568d54fadff20ff59365 (patch) | |
tree | 7108d5143e20e06bdae55ff0c4f759527576b569 /ppsthread.c | |
parent | 07859f6adeace85f64e9c6c6c8ce188834328df5 (diff) | |
download | gpsd-a006eef564b7a6bab2c8568d54fadff20ff59365.tar.gz |
Restore PPS function by backing out Miroslav Lichtvar's last commit.
It came in way, way out of sequence ansd screwed something up. He may
have been fixing some real problem, however. This requures
investigation.
All regression tests pass.
Diffstat (limited to 'ppsthread.c')
-rw-r--r-- | ppsthread.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/ppsthread.c b/ppsthread.c index 49883cb3..a4211a92 100644 --- a/ppsthread.c +++ b/ppsthread.c @@ -238,7 +238,7 @@ static int init_kernel_pps(struct gps_device_t *session) static /*@null@*/ void *gpsd_ppsmonitor(void *arg) { struct gps_device_t *session = (struct gps_device_t *)arg; - double last_fixtime_real = 0, last_fixtime_clock = 0; + double last_fixtime = 0; #ifndef HAVE_CLOCK_GETTIME struct timeval clock_tv = {0, 0}; #endif /* HAVE_CLOCK_GETTIME */ @@ -299,8 +299,7 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg) break; } /* quick, grab a copy of last_fixtime before it changes */ - last_fixtime_real = session->last_fixtime.real; - last_fixtime_clock = session->last_fixtime.clock; + last_fixtime = session->last_fixtime; /*@-noeffect@*/ /* get the time after we just woke up */ @@ -543,7 +542,7 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg) log = "Too long for 0.5Hz\n"; } #endif /* TIOCMIWAIT */ - if ( ok && last_second_used >= last_fixtime_real ) { + if ( ok && last_second_used >= last_fixtime ) { /* uh, oh, this second already handled */ ok = 0; log = "this second already handled\n"; @@ -552,8 +551,7 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg) if (ok) { /* offset is the skew from expected to observed pulse time */ double offset; - /* delay after last fix */ - double delay; + long l_offset; char *log1 = NULL; /* drift.real is the time we think the pulse represents */ struct timedrift_t drift; @@ -583,7 +581,7 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg) */ /*@+relaxtypes@*/ - drift.real.tv_sec = last_fixtime_real + 1; + drift.real.tv_sec = last_fixtime + 1; drift.real.tv_nsec = 0; /* need to be fixed for 5Hz */ drift.clock = clock_ts; /*@-relaxtypes@*/ @@ -592,15 +590,15 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg) * GPS serial input then use that */ offset = (drift.real.tv_sec - drift.clock.tv_sec); offset += ((drift.real.tv_nsec - drift.clock.tv_nsec) / 1e9); - delay = (drift.clock.tv_sec + drift.clock.tv_nsec / 1e9) - last_fixtime_clock; - if (0.0 > delay || 1.0 < delay) { + l_offset = (long) offset; + if (0 > l_offset || 1000000 < l_offset) { gpsd_report(session->context->debug, LOG_RAW, - "PPS: no current GPS seconds: %f\n", - delay); + "PPS: no current GPS seconds: %ld\n", + (long)l_offset); log1 = "timestamp out of range"; } else { /*@-compdef@*/ - last_second_used = last_fixtime_real; + last_second_used = last_fixtime; if (session->thread_report_hook != NULL) log1 = session->thread_report_hook(session, &drift); else |