summaryrefslogtreecommitdiff
path: root/monitor_ubx.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-11-12 05:37:20 -0500
committerEric S. Raymond <esr@thyrsus.com>2013-11-12 05:39:11 -0500
commit28a736ddcfd9d3a4dac72fe61c1ce6346e48bec2 (patch)
treef2df890b41b78a65cdd9525b75fb2ec6a289c0c0 /monitor_ubx.c
parentbe3e187224492864a400bb97e317a7c99b829e8e (diff)
downloadgpsd-28a736ddcfd9d3a4dac72fe61c1ce6346e48bec2.tar.gz
Fix PPS offset display bug by properly thread-locking some accesses.
Diffstat (limited to 'monitor_ubx.c')
-rw-r--r--monitor_ubx.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/monitor_ubx.c b/monitor_ubx.c
index e4e550d2..827a7c0e 100644
--- a/monitor_ubx.c
+++ b/monitor_ubx.c
@@ -229,6 +229,7 @@ static void ubx_update(void)
unsigned char *buf;
size_t data_len;
unsigned short msgid;
+ struct timedrift_t drift;
buf = session.packet.outbuffer;
msgid = (unsigned short)((buf[2] << 8) | buf[3]);
@@ -247,8 +248,13 @@ static void ubx_update(void)
break;
}
- if (timedelta != 0)
- (void)mvwprintw(ppswin, 1, 13, "%f", timedelta);
+ if (pps_thread_lastpps(&session, &drift) > 0) {
+ /*@-type@*/ /* splint is confused about struct timespec */
+ double timedelta = timespec_diff_ns(drift.real, drift.clock) * 1e-9;
+ /*@+type@*/
+ (void)mvwprintw(ppswin, 1, 13, "%.9f", timedelta);
+ wnoutrefresh(ppswin);
+ }
}
static int ubx_command(char line[]UNUSED)