bugGPSD - Bugs: bug #56094, ..2'nd roll over bug: gpsd...

 
 

bug #56094: ..2'nd roll over bug: gpsd "clock is 56 years wrong", like "1963-07-18T08:57:40.584Z"

Submitter:  None
Submitted:  Sun 07 Apr 2019 09:32:41 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 31 May 2019 02:17:51 AM UTC, comment #4: 

I see that a timebase.h patch for the new era has been applied.

Accordingly I am closing this bug. I have added  Arnt Karlsen <arnt@iaksess.no> and -email is unavailable- on the Cc list so they'll be notified.

If there is still a live issue here, please open it on the new tracker at https://gitlab.com/gpsd/gpsd/issues

Eric S. Raymond <esr>
Group administrator
Wed 24 Apr 2019 01:47:40 PM UTC, comment #3: 

RE: comment 2 it only happens when using SiRF binary mode. NMEA is unaffected.

-email is unavailable-

Anonymous
Mon 08 Apr 2019 05:20:49 PM UTC, comment #2: 

(related) My Globalsat bu353 reports invalid times post rollover 2.

{"class":"VERSION","release":"3.17","rev":"3.17","proto_major":3,"proto_minor":12}
{"class":"DEVICES","devices":[{"class":"DEVICE","path":"/dev/ttyUSB0","driver":"SiRF","activated":"2019-04-08T16:44:30.499Z","flags":1,"native":1,"bps":4800,"parity":"N","stopbits":1,"cycle":1.00}]}
{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"timing":false,"split24":false,"pps":false}
{"class":"SKY","device":"/dev/ttyUSB0","time":"2026-06-13T23:59:53.030Z","hdop":0.00}
{"class":"TPV","device":"/dev/ttyUSB0","mode":1,"time":"2026-06-13T23:59:53.030Z","ept":0.005}

and once it actually gets a fix...
{"class":"TPV","device":"/dev/ttyUSB0","mode":1,"time":"1902-10-17T10:16:32.460Z","ept":0.005}
{"class":"SKY","device":"/dev/ttyUSB0","time":"1902-10-17T10:16:33.460Z","xdop":1.34,"ydop":1.54,"vdop":5.99,"tdop":4.99,"hdop":0.00,"gdop":8.06,"pdop":6.33,"satellites":[{"PRN":16,"el":73,"az":6,"ss":44,"used":true},{"PRN":23,"el":50,"az":258,"ss":39,"used":true},{"PRN":26,"el":48,"az":55,"ss":36,"used":true},{"PRN":27,"el":58,"az":174,"ss":38,"used":true}]}

This would seem to indicate that the firmware is not happy screwing the time sync by a (not particularly) reasonable 6144 weeks. instead, it is offsetting it by 6073 weeks give or take some change.

MND 0x02=(49) a0a2002902ffe17e7fffc408ec004618b0000000000001040602000000e282b80810171b1a0905070800000000094eb0b3
THR 0x09=(17) a0a200090979d06000000e000001c0b0b3
DST 0x1b=(60) a0a200341b01000000000000000000000000000001000d02000d03000d04000d05000d06000d07000d08000d09000d0a000d0b000d0c000d0106b0b3
MTD 0x04=(196) a0a200bc04000000e2831c0c10204300bf27272727262626262626175d6000bf212121212121212120201a1e0c00bf191919191919191818181b3c3b00bf1d1d1d1d1d1d1c1c1c1c07c08300bf1d1d1d1c1c1c1c1c1c1c097fa400bf1f1f1f1e1e1e1e1e1e1e05
d51d0000000000000000000000001eb33f002d0e0e0e0e0e0e0e0e0e0d08543000bf1f1f1f1f1f1f1e1e1e1e1c8d03002d10101010101010100f0f0000000000000000000000000000000000000000000000000000000000001878b0b3
MND 0x02=(49) a0a2002902ffe17e7fffc408ec004618b0000000000001040a02000000e2831c0710171b1a090708000000000008b1b0b3
THR 0x09=(17) a0a200090979d06000000e000001c0b0b3
DST 0x1b=(60) a0a200341b01000000000000000000000000000001000d02000d03000d04000d05000d06000d07000d08000d09000d0a000d0b000d0c000d0106b0b3
MND 0x02=(49) a0a2002902ffe17e7fffc408ec004618b00000ffff0001040a02000000e283800710171b1a09070800000000000b13b0b3
THR 0x09=(17) a0a200090979d06000000e000001c0b0b3
DST 0x1b=(60) a0a200341b01000000000000000000000000000001000d02000d03000d04000d05000d06000d07000d08000d09000d0a000d0b000d0c000d0106b0b3
MND 0x02=(49) a0a2002902ffe17e7fffc408ec004618b0000000000001040602000000e283e40810171b1a0905070800000000097bb0b3
THR 0x09=(17) a0a200090979d06000000e000001c0b0b3
DST 0x1b=(60) a0a200341b01000000000000000000000000000001000d02000d03000d04000d05000d06000d07000d08000d09000d0a000d0b000d0c000d0106b0b3
MTD 0x04=(196) a0a200bc04000000e284480c10204300bf27272727262626262626175d6000bf212121212121212121201a1e0c00ad191919191919181818181b3c3b00bf1d1c1c1c1c1c1c1c1c1c07c08300bf1c1c1c1c1c1c1c1c1c1c097fa400bf1f1f1e1e1e1e1e1e1e1e05
d51d00ad0e0e0e0d0d0d0d0d0d0d1eb33f002d0e0e0e0e0e0e0e0d0d0d08543000bf1f1f1f1f1e1e1e1e1e1e1c8d03002d1110101010101010101000000000000000000000000000000000000000000000000000000000000019bbb0b3
MND 0x02=(49) a0a2002902ffe17e7fffc408ec004618b0ffff00000001040602000000e284480810171b1a09050708000000000adeb0b3
THR 0x09=(17) a0a200090979d06000000e000001c0b0b3
DST 0x1b=(60) a0a200341b01000000000000000000000000000001000d02000d03000d04000d05000d06000d07000d08000d09000d0a000d0b000d0c000d0106b0b3
MND 0x02=(49) a0a2002902ffe17e7fffc408ec004618b0ffff00010001040602000000e284ac0810171b1a09050708000000000b43b0b3
THR 0x09=(17) a0a200090979d06000000e000001c0b0b3
DST 0x1b=(60) a0a200341b01000000000000000000000000000001000d02000d03000d04000d05000d06000d07000d08000d09000d0a000d0b000d0c000d0106b0b3
MND 0x02=(49) a0a2002902ffe17e7fffc408ec004618b0ffff00010000040602000000e285100810171b1a09050708000000000aa7b0b3
THR 0x09=(17) a0a200090979d06000000e000001c0b0b3
DST 0x1b=(60) a0a200341b01000000000000000000000000000001000d02000d03000d04000d05000d06000d07000d08000d09000d0a000d0b000d0c000d0106b0b3

-email is unavailable-

Anonymous
Sun 07 Apr 2019 09:46:49 PM UTC, comment #1: 
Anonymous
Sun 07 Apr 2019 09:32:41 PM UTC, original submission:  

..from Devuan repoortbug:
From: Arnt Karlsen <arnt@iaksess.no>
To: Devuan Bug Tracking System <submit@bugs.devuan.org>, Debian Bug Tracking  System <submit@bugs.debian.org>
Cc: -email is unavailable-
Subject: gpsd: ..2'nd roll over bug: gpsd "clock is 56 years wrong", like  "1963-07-18T08:57:40.584Z"
Date: Sun, 7 Apr 2019 22:57:58 +0200
X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu)

Package: gpsd
Version: 3.16-4
Severity: important

..upstream bug. 




Hi,


..reportbug reports our (Devuan) BTS is down, bug report on gpsd:
Content-Type
: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Arnt <arnt@iaksess.no>
To: Devuan Bug Tracking System <submit@bugs.devuan.org>
Subject: gpsd: ..2'nd roll over bug: gpsd clock is 56 years wrong,
"1963-07-18T08:57:40.584Z" Message-ID:
<155465156363.24771.3526445890355259661.reportbug@sda3> X-Mailer:
reportbug 7.1.6+devuan2.1 Date: Sun, 07 Apr 2019 17:39:23 +0200
X-Debbugs-Cc: -email is unavailable-

Package: gpsd
Version: 3.16-4
Severity: important

..upstream bug. 


Dear Maintainer,

* Reporter, please consider answering these questions, where
appropriate *

   * What led up to the situation?

..according to http://catb.org/gpsd/NMEA.html#_dates_and_times :
GPS date and time are subject to a rollover problem in the 10-bit
week number counter, which will re-zero every 1024 weeks (roughly
every 19.6 years). The last rollover (and the first since GPS went
live in 1980) was in Aug-1999; the next will fall in Apr-2019.


..checks out rather well:
arnt@sda3:~$ date --date='1024 weeks ago'
Sun Aug 22 18:23:04 CEST 1999
arnt@sda3:~$ date --date='2048 weeks ago'
Sun Jan  6 17:23:36 CET 1980
arnt@sda3:~$ date --date='TZ=UTC 2048 weeks ago'
date: invalid date ‘TZ=UTC 2048 weeks ago’
arnt@sda3:~$ date --date='TZ="UTC" 2048 weeks ago'
Sun Jan  6 19:25:50 CET 1980
arnt@sda3:~$
http://www.leapsecond.com/java/gpsclock.htm
http://www.leapsecond.com/java/cal.htm


..fix suggestions: hard code third 10bit era and/or move to
the new 13bit "CNAV" data format pointed to above.

..this patch hard codes third 10bit era as suggested in
gpsd-3.1x's timebase.c:
arnt@nb6:~$ diff -u timebase.h-3.16 timebase.h-new
--- timebase.h-3.16     2016-01-08 20:30:27.000000000 +0100
+++ timebase.h-new      2019-04-07 20:11:52.903644739 +0200
@@ -1,9 +1,9 @@
 /*
  * Constants used for GPS time detection and rollover correction.
  *
- * Correct for week beginning 2016-01-07T00:00:00
+ * Correct for week beginning 2019-04-07T02:00:00 UTC
  */
 #define BUILD_CENTURY  2000
-#define BUILD_WEEK     854            # Assumes 10-bit week counter
-#define BUILD_LEAPSECONDS      17
-#define BUILD_ROLLOVERS        1      # Assumes 10-bit week counter
+#define BUILD_WEEK     1              # Assumes 10-bit week counter
+#define BUILD_LEAPSECONDS      19
+#define BUILD_ROLLOVERS        2      # Assumes 10-bit week counter


..and ditto for gpsd-3.17:
arnt@nb6:~$ diff -u timebase.h-3.17 timebase.h-new
--- timebase.h-3.17     2017-09-07 13:53:40.000000000 +0200
+++ timebase.h-new      2019-04-07 20:11:52.903644739 +0200
@@ -1,9 +1,9 @@
 /*
  * Constants used for GPS time detection and rollover correction.
  *
- * Correct for week beginning 2017-09-07T00:00:00
+ * Correct for week beginning 2019-04-07T02:00:00 UTC
  */
 #define BUILD_CENTURY  2000
-#define BUILD_WEEK     941           # Assumes 10-bit week counter
+#define BUILD_WEEK     1             # Assumes 10-bit week counter
#define BUILD_LEAPSECONDS      19
-#define BUILD_ROLLOVERS        1         # Assumes 10-bit week counter
+#define BUILD_ROLLOVERS        2         # Assumes 10-bit week counter



..this patch hard codes third 10bit era as suggested in
gpsd-3.11's timebase.c:
arnt@sda3:~$ diff -u timebase.h*
--- timebase.h-3.11  2019-04-07 19:19:42.442197516 +0200
+++ timebase.h-ny      2019-04-07 19:18:28.572535352 +0200
@@ -1,8 +1,8 @@
 /*
  * Constants used for GPS time detection and rollover correction.
  *
- * Correct for week beginning 2014-08-21T00:00:00
+ * Correct for week beginning 2019-04-07T00:00:00
  */
-#define CENTURY_BASE   201400
-#define LEAPSECOND_NOW 16
-#define GPS_WEEK_NOW   1806
+#define CENTURY_BASE   201900
+#define LEAPSECOND_NOW 19
+#define GPS_WEEK_NOW   2049


..current timebase.h in gpsd-3.11 source:
arnt@sda3:~$ cat timebase.h
/*

  • Constants used for GPS time detection and rollover correction.

 *

  • Correct for week beginning 2014-08-21T00:00:00

 */
#define CENTURY_BASE    201400
#define LEAPSECOND_NOW  16
#define GPS_WEEK_NOW    1806
arnt@sda3:~$




   * What exactly did you do (or not do) that was effective (or
     ineffective)?
   * What was the outcome of this action?
   * What outcome did you expect instead?

* End of the template - remove these template lines *


-- System Information:
Distributor ID: Devuan
Description:    Devuan GNU/Linux 2.0 (ascii)
Release:        2.0
Codename:       ascii

Architecture: armv6l

Kernel: Linux 4.19.32+
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=locale: Cannot
set LC_ALL to default locale: No such file or directory UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages gpsd depends on:
ii  adduser              3.115
ii  init-system-helpers  1.48+devuan2.0
ii  libbluetooth3        5.43-2+deb9u1
ii  libc6                2.24-11+deb9u4
ii  libdbus-1-3          1.10.22-1+devuan2
ii  libgps22             3.16-4
ii  libusb-1.0-0         2:1.0.21-1
ii  lsb-base             4.1+devuan2
ii  netbase              5.4

Versions of packages gpsd recommends:
ii  python  2.7.13-2
pn  udev    <none>

Versions of packages gpsd suggests:
ii  dbus          1.10.22-1+devuan2
ii  gpsd-clients  3.16-4

-- debconf information:


--
..med vennlig hilsen = with Kind Regards from Arnt Karlsen
...with a number of polar bear hunters in his ancestry...
  Scenarios always come in sets of three:
  best case, worst case, and just in case.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by esr (Posted a comment)
  • -email is unavailable- added by esr
  • -email is unavailable- added by esr
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-05-31 esr Open/ClosedOpen Closed
        Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added arnt karlsen <arnt@iaksess.no>

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code