===== Chrony =====
Chrony has some advantages over old NTPd.
* https://wiki.alpinelinux.org/wiki/Chrony_and_GPSD
* https://forristal.org/blog/2018/01/making-a-raspberry-pi-stratum-1-clock/
* https://gpsd.gitlab.io/gpsd/gpsd-time-service-howto.html
However, the version packaged for Debian/Ubuntu seems to be broken in that SOCKs don't work. If you manually compile and install it you'll be good.
==== Compile & Install ====
This assumes a brand new debian-based install.
sudo apt install git bison build-essential asciidoctor -y
git clone https://github.com/mlichvar/chrony
cd chrony
./configure
make ; make docs
sudo make install
==== chronyd.service ====
A systemd service file is not included, here's a very simple one.
[Unit]
Description=chrony, an NTP client/server
Documentation=man:chronyd(8) man:chronyc(1) man:chrony.conf(5)
Conflicts=openntpd.service ntp.service ntpsec.service
Wants=time-sync.target
Before=time-sync.target
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/sbin/chronyd -f /etc/chrony.conf
[Install]
Alias=chronyd.service
WantedBy=multi-user.target
Install:
cp chronyd.service /lib/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable chronyd
Make sure After=chronyd.service is in the [Unit] section of gpsd.service. Chronyd must be started first because it creates the sock that gpsd writes to.
==== chrony.conf ====
Note! Change ''ttyAMA0'' to whatever your UART is coming in on!
server time-a.nist.gov
server time-a-wwv.nist.gov
server time-a-b.nist.gov
refclock SOCK /run/chrony.ttyAMA0.sock refid GPS
rtcsync
logchange 0.5
local stratum 10
makestep 1.0 3
logdir /var/log/chrony
log statistics tracking
dumpdir /var/log/chrony
driftfile /chrony.drift
allow