summaryrefslogtreecommitdiff
path: root/gpsd_json.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-04-01 03:02:02 -0400
committerEric S. Raymond <esr@thyrsus.com>2015-04-01 03:02:02 -0400
commit224469fbfd1dedccb298263173d5fcd199e0f128 (patch)
tree23dc186e523e83c787e8e259020d062e9ae6a5ab /gpsd_json.c
parent90e1d453f282f014a959260764431e64a791942d (diff)
downloadgpsd-224469fbfd1dedccb298263173d5fcd199e0f128.tar.gz
Properly thread-interlock some timing code.
Diffstat (limited to 'gpsd_json.c')
-rw-r--r--gpsd_json.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gpsd_json.c b/gpsd_json.c
index f27d29c9..8bbcb45f 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -188,8 +188,11 @@ void json_tpv_dump(const struct gps_device_t *session,
#ifdef PPS_ENABLE
if (session->pps_thread.ppsout_count) {
char ts_str[TIMESPEC_LEN];
- struct timespec clock_tmp = session->pps_thread.ppsout_last.clock;
- timespec_str( &clock_tmp, ts_str, sizeof(ts_str) );
+ struct timedelta_t timedelta;
+ /* ugh - de-consting this might get us in trouble someday */
+ pps_thread_ppsout(&((struct gps_device_t *)session)->pps_thread,
+ &timedelta);
+ timespec_str(&timedelta.clock, ts_str, sizeof(ts_str) );
str_appendf(reply, replylen, "\"pps\":%s,", ts_str);
/* TODO: add PPS precision to JSON output */
}