summaryrefslogtreecommitdiff
path: root/monitor_ubx.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2015-02-02 20:45:45 -0800
committerGary E. Miller <gem@rellim.com>2015-02-02 20:45:45 -0800
commit2235687bfaded7fc12994b2a4cbd48a7d31b2acc (patch)
treeba23093ec17568abfab4184e164c764f514589a9 /monitor_ubx.c
parent941818328ea28dacd238f0b38208c039e4b6e9fc (diff)
downloadgpsd-2235687bfaded7fc12994b2a4cbd48a7d31b2acc.tar.gz
Fix a carry error in TS_SUB()
TS_SUB getting pretty big. It should probably be a function. Will also need a function to format a timespec as a nice string.
Diffstat (limited to 'monitor_ubx.c')
-rw-r--r--monitor_ubx.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/monitor_ubx.c b/monitor_ubx.c
index a50d5d3f..2256d9e3 100644
--- a/monitor_ubx.c
+++ b/monitor_ubx.c
@@ -260,19 +260,19 @@ static void ubx_update(void)
if (pps_thread_lastpps(&session, &drift) > 0) {
/* NOTE: can not use double here due to precision requirements */
struct timespec timedelta;
- int sign = ' ';
+ char sign = ' ';
TS_SUB( &timedelta, &drift.clock, &drift.real);
if ( 86400 < (long)labs(timedelta.tv_sec) ) {
/* more than one day off, overflow */
/* need a bigger field to show it */
(void)mvwprintw(ppswin, 1, 13, "> 1 day");
} else {
- if ( 0 > timedelta.tv_nsec ) {
+ if ( (0 > timedelta.tv_nsec ) || ( 0 > timedelta.tv_sec ) ) {
sign = '-';
}
(void)mvwprintw(ppswin, 1, 13, "%c%ld.%09ld",
sign,
- (long)timedelta.tv_sec,
+ (long)labs(timedelta.tv_sec),
(long)labs(timedelta.tv_nsec));
}
(void)wnoutrefresh(ppswin);