summaryrefslogtreecommitdiff
path: root/monitor_sirf.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_sirf.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_sirf.c')
-rw-r--r--monitor_sirf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/monitor_sirf.c b/monitor_sirf.c
index 6ef24c19..2b8e642f 100644
--- a/monitor_sirf.c
+++ b/monitor_sirf.c
@@ -593,19 +593,19 @@ static void sirf_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(mid7win, 2, 39, "> 1 day");
} else {
- if ( 0 > timedelta.tv_nsec ) {
+ if ( (0 > timedelta.tv_nsec ) || ( 0 > timedelta.tv_sec ) ) {
sign = '-';
}
(void)mvwprintw(mid7win, 4, 39, "%c%ld.%09ld",
sign,
- (long)timedelta.tv_sec,
+ (long)labs(timedelta.tv_sec),
(long)labs(timedelta.tv_nsec));
}
(void)wnoutrefresh(mid7win);