diff options
author | Gary E. Miller <gem@rellim.com> | 2013-11-29 17:45:29 -0800 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2013-11-29 17:45:29 -0800 |
commit | dbeab3096df28a545a92f05012fe28226973e499 (patch) | |
tree | db2f61218bb356d225e14ce2cb3ddf4987556fe0 /ppsthread.c | |
parent | 0e436f1b59cdec2f1fbe9336661a51dfcf9151bd (diff) | |
download | gpsd-dbeab3096df28a545a92f05012fe28226973e499.tar.gz |
Quick, grab a copy of last_fixtime in ppsthread before it changes.
Diffstat (limited to 'ppsthread.c')
-rw-r--r-- | ppsthread.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ppsthread.c b/ppsthread.c index 6073459d..7d7736d2 100644 --- a/ppsthread.c +++ b/ppsthread.c @@ -238,6 +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 = 0; #ifndef HAVE_CLOCK_GETTIME struct timeval clock_tv = {0, 0}; #endif /* HAVE_CLOCK_GETTIME */ @@ -289,6 +290,8 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg) errno, strerror(errno)); break; } + /* quick, grab a copy of last_fixtime before it changes */ + last_fixtime = session->last_fixtime; /*@-noeffect@*/ /* get the time after we just woke up */ @@ -357,8 +360,8 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg) #endif if ( 0 > time_pps_fetch(session->kernelpps_handle, PPS_TSFMT_TSPEC , &pi, &kernelpps_tv)) { - gpsd_report(session->context->debug, LOG_ERROR, - "KPPS kernel PPS failed\n"); + // gpsd_report(session->context->debug, LOG_ERROR, + // "KPPS kernel PPS failed\n"); } else { // find the last edge // FIXME a bit simplistic, should hook into the @@ -525,7 +528,7 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg) log = "Too long for 0.5Hz\n"; } #endif /* TIOCMIWAIT */ - if ( ok && last_second_used >= session->last_fixtime ) { + if ( ok && last_second_used >= last_fixtime ) { /* uh, oh, this second already handled */ ok = 0; log = "this second already handled\n"; @@ -561,7 +564,7 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg) */ /*@+relaxtypes@*/ - drift.real.tv_sec = session->last_fixtime + 1; + drift.real.tv_sec = last_fixtime + 1; drift.real.tv_nsec = 0; /* need to be fixed for 5Hz */ drift.clock = clock_ts; /*@-relaxtypes@*/ @@ -578,7 +581,7 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg) log1 = "timestamp out of range"; } else { /*@-compdef@*/ - last_second_used = session->last_fixtime; + last_second_used = last_fixtime; if (session->thread_report_hook != NULL) log1 = session->thread_report_hook(session, &drift); else |