Package: gpsd
Version: 3.17-3
Severity: normal
Tags: patch upstream

When using the gpsmon tool with a u-blox GPS module, the time is
reported incorrectly in the NAV_SOL box. This is because of a series of
arithmetic errors in the code (times are reported in milliseconds, but
the math seems to assume they are in centiseconds).

This patch corrects the error and produces accurate times. Tested with
both a NEO-M8N connected over USB and a NEO-6N module on a Raspberry Pi.

-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (102, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.14.3 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages gpsd depends on:
ii  adduser        3.116
ii  libbluetooth3  5.47-1
ii  libc6          2.25-3
ii  libdbus-1-3    1.12.2-1
ii  libgps23       3.17-3
ii  libusb-1.0-0   2:1.0.21-2
ii  lsb-base       9.20170808
ii  netbase        5.4
ii  systemd-sysv   235-3

Versions of packages gpsd recommends:
ii  python  2.7.14-3
ii  udev    235-3

Versions of packages gpsd suggests:
ii  dbus          1.12.2-1
ii  gpsd-clients  3.17-3

-- Configuration Files:
/etc/default/gpsd changed:
START_DAEMON="true"
USBAUTO="true"
DEVICES=""
GPSD_OPTIONS="-D 1"


-- debconf information:
  gpsd/autodetection: false
  gpsd/socket: /var/run/gpsd.sock
  gpsd/daemon_options:
* gpsd/start_daemon: false
  gpsd/device:
  gpsd/brokenconfig:
diff --git a/monitor_ubx.c b/monitor_ubx.c
index 2ba82de8..35026349 100644
--- a/monitor_ubx.c
+++ b/monitor_ubx.c
@@ -173,16 +173,16 @@ static void display_nav_sol(unsigned char *buf, size_t 
data_len)
 
     (void)wmove(navsolwin, 7, 7);
     {
-       unsigned int day = tow / 8640000;
-       unsigned int tod = tow % 8640000;
-       unsigned int h = tod / 360000;
-       unsigned int m = tod % 360000;
-       unsigned int s = m % 6000;
+       unsigned int day = tow / 86400000;
+       unsigned int tod = tow % 86400000;
+       unsigned int h = tod / 3600000;
+       unsigned int m = tod % 3600000;
+       unsigned int s = m % 60000;
 
-       m = (m - s) / 6000;
+       m = (m - s) / 60000;
 
        (void)wattrset(navsolwin, A_UNDERLINE);
-       (void)wprintw(navsolwin, "%u %02u:%02u:%05.2f", day, h, m, (double)s / 
100);
+       (void)wprintw(navsolwin, "%u %02u:%02u:%05.2f", day, h, m, (double)s / 
1000);
        (void)wattrset(navsolwin, A_NORMAL);
     }
     (void)wmove(navsolwin, 8, 11);

Reply via email to