<html><head>

<style id="css_styles"> 
blockquote.cite { margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc }
blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding-top: 0px; }
a img { border: 0px; }
li[style='text-align: center;'], li[style='text-align: right;'] {  list-style-position: inside;}
body { font-family: Segoe UI; font-size: 12pt;   }
 </style>
</head>
<body><div>Hi.</div><div><br /></div><div>I'm trying to get gpsd (3.20) and ntpd (NTPsec 1.1.8+) to keep reliable time when no network is available. This is a common use case for one of my customers. Outdoors, full sky view, no network. Time accuracy (< 1 ms) is critical, and well within the capabilities of the hardware.</div><div><br /></div><div>But - when there are no network severs available, ntpd marks my GPS as a falseticker. That leaves zero tickers, so PPS is x-ed as well. </div><div><br /></div><div><font face="Courier New">     remote           refid      st t when poll reach   delay   offset   jitter<br />xSHM(2)          .PPS.            0 l    2    8  377      0ns -13.57us 17.302us<br /> 0.us.pool.ntp.o .DNS.           16 u    -    8    0      0ns      0ns  1.907us<br /> 1.us.pool.ntp.o .DNS.           16 u    -    8    0      0ns      0ns  1.907us<br /> 2.us.pool.ntp.o .DNS.           16 u    -    8    0      0ns      0ns  1.907us<br /> 3.us.pool.ntp.o .DNS.           16 u    -    8    0      0ns      0ns  1.907us<br />xSHM(0)          .GPS.            0 l    6    8  377      0ns 4.7432ms 2.3207ms<br /> pool.ntp.org    .POOL.          16 p    -    8    0      0ns      0ns  1.907us<br />ntpd ntpsec-1.1.8+ 2020-03-04T20:55:58Z        Updated: 2020-03-19T01:28:58 (4)<br /> lstint avgint rstr r m v  count rport remote address<br />      0  0.403    0 . 6 2   1891 45046 localhost<br /></font></div>
<div><br /></div><div>I've tweaked the value of time1 on my PPS refclock command, and occasionally ntpd will take the GPS off the blacklist, but it never lasts, although the PPS offset seems to stay very small.</div><div>It's been suggested that ntpd might not be the best tool for this scenario, but I'd prefer to salvage my development investment if possible.</div><div><br /></div><div>Hardware:</div><div>Custom PCB with u-blox NEO-8MT, connected via USB to a Xilinx Zynq (Artix FPGA + ARM Cortex A9). A kernel-mode driver handles PPS interrupts from the u-blox, using the standard kernel PPSAPI.</div><div><br /></div><div>Software:</div><div>Linux kernel 4.19.101</div><div>Ubuntu 18.04 LTS</div><div>gpsd 3.20</div><div>NTPsec 1.1.8+</div><div>Custom kernel PPS driver</div><div><br /></div><div>Configuration:</div><div>ntpd.conf:</div><div><font face="Courier New">minsane 1
</font></div><div><font face="Courier New">refclock shm unit 2 refid PPS minpoll 3 maxpoll 3 prefer flag4 1
</font></div><div><font face="Courier New">server 0.us.pool.ntp.org iburst
</font></div><div><font face="Courier New">server 1.us.pool.ntp.org iburst
</font></div><div><font face="Courier New">server 2.us.pool.ntp.org iburst
</font></div><div><font face="Courier New">server 3.us.pool.ntp.org iburst
</font></div><div><font face="Courier New">refclock shm unit 0 refid GPS minpoll 3 maxpoll 4 time1 0.080 flag4 1
</font></div><div><font face="Courier New">restrict default kod limited nomodify nopeer noquery
</font></div><div><font face="Courier New">restrict -6 default kod limited nomodify nopeer noquery
</font></div><div><font face="Courier New">restrict 127.0.0.1
</font></div><div><font face="Courier New">restrict -6 ::1
</font></div><div><font face="Courier New">driftfile /var/lib/ntp/ntp.drift
</font></div><div><font face="Courier New">statsdir /var/log/ntpstats/
</font></div><div><font face="Courier New">statistics loopstats peerstats clockstats
</font></div><div><font face="Courier New">filegen loopstats file loopstats type day enable
</font></div><div><font face="Courier New">filegen peerstats file peerstats type day enable
</font></div><div><font face="Courier New">filegen clockstats file clockstats type day enable
</font></div><div><font face="Courier New">logfile /var/log/ntpd.log
</font></div><div><font face="Courier New">logconfig =syncall +clockall +peerall +sysall
</font></div><div><font face="Courier New"><br /></font></div><div><font size="3">Command lines:</font></div><div><font face="Courier New">root@MPM-4006:~# ps -ef|egrep '(ntp|gps)'|grep -v grep<br />nobody    9609     1  0 01:15 ?        00:01:05 /usr/local/sbin/gpsd -n /dev/core100/gnss /dev/pps0<br />ntp      19607     1  0 02:39 ?        00:00:22 /usr/local/sbin/ntpd -D 10 -g -N -u ntp:ntp<br /></font></div><div><br /></div><div><span>PPS is working:</span></div><div><font face="Courier New">root@MPM-4006:/etc/ntp.d# ppstest /dev/pps0<br />trying PPS source "/dev/pps0"<br />found PPS source "/dev/pps0"<br />ok, found 1 source(s), now start fetching data...<br />source 0 - assert 1584584485.000037822, sequence: 3939 - clear  0.000000000, sequence: 0<br />source 0 - assert 1584584486.000036522, sequence: 3940 - clear  0.000000000, sequence: 0<br />source 0 - assert 1584584487.000044277, sequence: 3941 - clear  0.000000000, sequence: 0<br />source 0 - assert 1584584488.000039254, sequence: 3942 - clear  0.000000000, sequence: 0<br />source 0 - assert 1584584489.000037024, sequence: 3943 - clear  0.000000000, sequence: 0<br />source 0 - assert 1584584490.000036379, sequence: 3944 - clear  0.000000000, sequence: 0<br />source 0 - assert 1584584491.000037345, sequence: 3945 - clear  0.000000000, sequence: 0<br />source 0 - assert 1584584492.000037605, sequence: 3946 - clear  0.000000000, sequence: 0<br />source 0 - assert 1584584493.000037058, sequence: 3947 - clear  0.000000000, sequence: 0<br /></font></div><div><br /></div><div>A few hours of ntpd.log:</div><div><font face="Courier New" size="3">root@MPM-4006:~# tail -40000 /var/log/ntpd.log | grep -a DNS|wc -l
</font></div><div><font face="Courier New" size="3">39915
</font></div><div><br /></div><div><font face="Courier New">root@MPM-4006:~# tail -40000 /var/log/ntpd.log | grep -a -v DNS<br /></font></div><div><font face="Courier New">2020-03-19T02:39:10 ntpd[12274]: ERR: ntpd exiting on signal 15 (Terminated)<br />2020-03-19T02:39:10 ntpd[12274]: PROTO: SHM(2) 9612 82 demobilize assoc 43954<br />2020-03-19T02:39:10 ntpd[12274]: PROTO: 127.127.28.2 unlink local addr 127.0.0.1 -> <null><br />2020-03-19T02:39:10 ntpd[12274]: PROTO: 0.0.0.0 8012 82 demobilize assoc 43955<br />2020-03-19T02:39:10 ntpd[12274]: PROTO: 0.0.0.0 8012 82 demobilize assoc 43956<br />2020-03-19T02:39:10 ntpd[12274]: PROTO: 0.0.0.0 8012 82 demobilize assoc 43957<br />2020-03-19T02:39:10 ntpd[12274]: PROTO: 0.0.0.0 8012 82 demobilize assoc 43958<br />2020-03-19T02:39:10 ntpd[12274]: PROTO: SHM(0) 9412 82 demobilize assoc 43959<br />2020-03-19T02:39:10 ntpd[12274]: PROTO: 127.127.28.0 unlink local addr 127.0.0.1 -> <null><br />2020-03-19T02:39:10 ntpd[12274]: PROTO: 0.0.0.0 8812 82 demobilize assoc 43960<br />2020-03-19T02:39:10 ntpd[12274]: PROTO: 0.0.0.0 001d 0d kern kernel time sync disabled<br />2020-03-19T02:39:11 ntpd[19607]: INIT: Using SO_TIMESTAMPNS<br />2020-03-19T02:39:11 ntpd[19607]: IO: Listen and drop on 0 v6wildcard [::]:123<br />2020-03-19T02:39:11 ntpd[19607]: IO: Listen and drop on 1 v4wildcard 0.0.0.0:123<br />2020-03-19T02:39:11 ntpd[19607]: IO: Listen normally on 2 lo 127.0.0.1:123<br />2020-03-19T02:39:11 ntpd[19607]: IO: Listen normally on 3 lo [::1]:123<br />2020-03-19T02:39:11 ntpd[19607]: IO: Listening on routing socket on fd #20 for interface updates<br />2020-03-19T02:39:11 ntpd[19607]: PROTO: 127.127.28.2 8011 81 mobilize assoc 21309<br />2020-03-19T02:39:11 ntpd[19607]: PROTO: 0.0.0.0 8011 81 mobilize assoc 21310<br />2020-03-19T02:39:11 ntpd[19607]: PROTO: 0.0.0.0 8011 81 mobilize assoc 21311<br />2020-03-19T02:39:11 ntpd[19607]: PROTO: 0.0.0.0 8011 81 mobilize assoc 21312<br />2020-03-19T02:39:11 ntpd[19607]: PROTO: 0.0.0.0 8011 81 mobilize assoc 21313<br />2020-03-19T02:39:11 ntpd[19607]: PROTO: 127.127.28.0 8011 81 mobilize assoc 21314<br />2020-03-19T02:39:11 ntpd[19607]: CONFIG: configpeers: Ignoring duplicate '127.127.28.2'<br />2020-03-19T02:39:11 ntpd[19607]: CONFIG: configpeers: Ignoring duplicate '127.127.28.0'<br />2020-03-19T02:39:11 ntpd[19607]: PROTO: 0.0.0.0 8811 81 mobilize assoc 21315<br />2020-03-19T02:39:11 ntpd[19607]: SYNC: Found 10 servers, suggest minsane at least 3<br />2020-03-19T02:39:11 ntpd[19607]: INIT: This system has a 32-bit time_t.<br />2020-03-19T02:39:11 ntpd[19607]: INIT: This ntpd will fail on 2038-01-19T03:14:07Z.<br />2020-03-19T02:39:11 ntpd[19607]: PROTO: 0.0.0.0 c01d 0d kern kernel time sync enabled<br />2020-03-19T02:39:11 ntpd[19607]: PROTO: 0.0.0.0 c012 02 freq_set kernel 7.502304 PPM<br />2020-03-19T02:39:11 ntpd[19607]: PROTO: 0.0.0.0 c016 06 restart<br />2020-03-19T02:39:11 ntpd[19607]: INIT: OpenSSL 1.1.0g  2 Nov 2017, 1010007f<br />2020-03-19T02:39:11 ntpd[19607]: NTSc: Using system default root certificates.<br />2020-03-19T02:39:12 ntpd[19607]: PROTO: SHM(2) 8014 84 reachable<br />2020-03-19T02:39:12 ntpd[19607]: PROTO: SHM(2) 901a 8a sys_peer<br />2020-03-19T02:39:12 ntpd[19607]: PROTO: 0.0.0.0 c415 05 clock_sync<br />2020-03-19T02:39:17 ntpd[19607]: PROTO: SHM(0) 8014 84 reachable<br />2020-03-19T02:39:17 ntpd[19607]: PROTO: 0.0.0.0 0418 08 no_sys_peer<br />2020-03-19T02:39:49 ntpd[19607]: PROTO: SHM(2) 912a 8a sys_peer<br />2020-03-19T02:40:05 ntpd[19607]: PROTO: 0.0.0.0 0428 08 no_sys_peer<br />2020-03-19T02:40:13 ntpd[19607]: PROTO: SHM(2) 913a 8a sys_peer<br />2020-03-19T02:40:21 ntpd[19607]: PROTO: 0.0.0.0 0438 08 no_sys_peer<br />2020-03-19T02:40:32 ntpd[19607]: PROTO: SHM(2) 914a 8a sys_peer<br />2020-03-19T02:40:37 ntpd[19607]: PROTO: 0.0.0.0 0448 08 no_sys_peer<br />2020-03-19T02:41:41 ntpd[19607]: PROTO: SHM(2) 915a 8a sys_peer<br />2020-03-19T02:41:49 ntpd[19607]: PROTO: 0.0.0.0 0458 08 no_sys_peer<br />2020-03-19T02:41:57 ntpd[19607]: PROTO: SHM(2) 916a 8a sys_peer<br />2020-03-19T02:42:05 ntpd[19607]: PROTO: 0.0.0.0 0468 08 no_sys_peer<br />2020-03-19T02:42:13 ntpd[19607]: PROTO: SHM(2) 917a 8a sys_peer<br />2020-03-19T02:42:21 ntpd[19607]: PROTO: 0.0.0.0 0478 08 no_sys_peer<br />2020-03-19T02:42:45 ntpd[19607]: PROTO: SHM(2) 918a 8a sys_peer<br />2020-03-19T02:42:53 ntpd[19607]: PROTO: 0.0.0.0 0488 08 no_sys_peer<br />2020-03-19T02:43:17 ntpd[19607]: PROTO: SHM(2) 919a 8a sys_peer<br />2020-03-19T02:43:25 ntpd[19607]: PROTO: 0.0.0.0 0498 08 no_sys_peer<br />2020-03-19T02:43:57 ntpd[19607]: PROTO: SHM(2) 91aa 8a sys_peer<br />2020-03-19T02:44:05 ntpd[19607]: PROTO: 0.0.0.0 04a8 08 no_sys_peer<br />2020-03-19T02:44:13 ntpd[19607]: PROTO: SHM(2) 91ba 8a sys_peer<br />2020-03-19T02:45:01 ntpd[19607]: PROTO: 0.0.0.0 04b8 08 no_sys_peer<br />2020-03-19T02:45:25 ntpd[19607]: PROTO: SHM(2) 91ca 8a sys_peer<br />2020-03-19T02:45:33 ntpd[19607]: PROTO: 0.0.0.0 04c8 08 no_sys_peer<br />2020-03-19T02:45:57 ntpd[19607]: PROTO: SHM(2) 91da 8a sys_peer<br />2020-03-19T02:46:13 ntpd[19607]: PROTO: 0.0.0.0 04d8 08 no_sys_peer<br />2020-03-19T02:47:17 ntpd[19607]: PROTO: SHM(2) 91ea 8a sys_peer<br />2020-03-19T02:47:25 ntpd[19607]: PROTO: 0.0.0.0 04e8 08 no_sys_peer<br />2020-03-19T02:47:41 ntpd[19607]: PROTO: SHM(2) 91fa 8a sys_peer<br />2020-03-19T02:47:57 ntpd[19607]: PROTO: 0.0.0.0 04f8 08 no_sys_peer<br />2020-03-19T04:47:44 ntpd[19607]: PROTO: SHM(2) 911b 8b clock_event clk_no_reply<br />2020-03-19T04:47:49 ntpd[19607]: PROTO: SHM(0) 911b 8b clock_event clk_no_reply<br />2020-03-19T04:48:40 ntpd[19607]: PROTO: SHM(2) 8113 83 unreachable<br />2020-03-19T04:48:40 ntpd[19607]: PROTO: SHM(2) 8114 84 reachable<br />2020-03-19T05:21:25 ntpd[19607]: PROTO: SHM(2) 911a 8a sys_peer<br />2020-03-19T05:27:25 ntpd[19607]: PROTO: SHM(2) 912a 8a sys_peer<br />2020-03-19T05:28:29 ntpd[19607]: PROTO: SHM(2) 913a 8a sys_peer<br />2020-03-19T05:29:25 ntpd[19607]: PROTO: SHM(2) 914a 8a sys_peer<br />2020-03-19T05:33:41 ntpd[19607]: PROTO: SHM(2) 915a 8a sys_peer<br />2020-03-19T05:35:09 ntpd[19607]: PROTO: SHM(2) 916a 8a sys_peer<br />2020-03-19T05:39:41 ntpd[19607]: PROTO: SHM(2) 917a 8a sys_peer<br />2020-03-19T05:53:01 ntpd[19607]: PROTO: SHM(2) 918a 8a sys_peer<br />2020-03-19T05:59:57 ntpd[19607]: PROTO: SHM(2) 919a 8a sys_peer<br />2020-03-19T06:00:53 ntpd[19607]: PROTO: SHM(2) 91aa 8a sys_peer<br />2020-03-19T06:20:37 ntpd[19607]: PROTO: SHM(2) 91ba 8a sys_peer<br />2020-03-19T06:30:37 ntpd[19607]: PROTO: SHM(2) 91ca 8a sys_peer<br />2020-03-19T06:31:09 ntpd[19607]: PROTO: SHM(2) 91da 8a sys_peer</font><br /></div><div><br /></div><div id="signature_old"><div><span>Thanks,</span></div><div><span><br /></span></div><div><span style="font-size: 12pt;">-Nick</span></div></div><div><br /></div>
</body></html>