最近の Raspberry OSやdebian の系統では、ntp からchronyにシフトしている様なので、サクッとchronyをインストールしてみたら、アッサリgpsと同期してくれた様です。
参考サイト
- Are multiple pps-gpio overlays possible?
- Raspberry Pi 3 Model B + USB接続GPSレシーバ + ChronyでStratum 1なNTPサーバを作る
astroberry@astroberry:~ $ sudo apt install chrony
/etc/chrony/chrony.conf の 一番最後のGPSに関するコメントを外して有効にました。
astroberry@astroberry:/etc/chrony $ cat chrony.conf
# Welcome to the chrony configuration file. See chrony.conf(5) for more
# information about usuable directives.
pool 2.debian.pool.ntp.org iburst
# This directive specify the location of the file containing ID/key pairs for
# NTP authentication.
keyfile /etc/chrony/chrony.keys
# This directive specify the file into which chronyd will store the rate
# information.
driftfile /var/lib/chrony/chrony.drift
# Uncomment the following line to turn logging on.
#log tracking measurements statistics
# Log files location.
logdir /var/log/chrony
# Stop bad estimates upsetting machine clock.
maxupdateskew 100.0
# This directive enables kernel synchronisation (every 11 minutes) of the
# real-time clock. Note that it can’t be used along with the 'rtcfile' directive.
rtcsync
# Step the system clock instead of slewing it if the adjustment is larger than
# one second, but only in the first three clock updates.
makestep 1 3
#refclock SHM 0 offset 0.5 delay 0.2 refid GPS
refclock SHM 0 offset 0.5 delay 0.2 refid GPS
そして実行
astroberry@astroberry:/etc/chrony $ sudo systemctl enable chrony
Synchronizing state of chrony.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable chrony
astroberry@astroberry:/etc/chrony $ sudo systemctl start chrony
確認
astroberry@astroberry:/etc/chrony $ timedatectl status
Local time: Tue 2020-06-23 19:05:34 JST
Universal time: Tue 2020-06-23 10:05:34 UTC
RTC time: n/a
Time zone: Asia/Tokyo (JST, +0900)
System clock synchronized: yes
NTP service: inactive
RTC in local TZ: no
思わず「いただきました!星三つです!」と叫びたくなる程のメッセージ!!
System clock synchronized: yes
勿論LANケーブルを外した状態で確認したので、大丈夫でしょう。
astroberry@astroberry:/etc/chrony $ chronyc sources -v
210 Number of sources = 1
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
#* GPS 0 4 377 15 +552us[+3610us] +/- 102ms
誤差が1ミリ秒以下の様です 🙂