From 224469fbfd1dedccb298263173d5fcd199e0f128 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 1 Apr 2015 03:02:02 -0400 Subject: Properly thread-interlock some timing code. --- gpsd_json.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gpsd_json.c') 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 */ } -- cgit v1.2.1