Skip to content

Instantly share code, notes, and snippets.

@mstyne
Created July 6, 2025 21:27
Show Gist options
  • Select an option

  • Save mstyne/4b6ca5da58866a1c8130cc48310978f4 to your computer and use it in GitHub Desktop.

Select an option

Save mstyne/4b6ca5da58866a1c8130cc48310978f4 to your computer and use it in GitHub Desktop.
NTP GPS PPS raspberry pi for morans
### INITIAL CONFIG
stty -F /dev/serial0 raw 9600 cs8 clocal -cstopb
sudo systemctl disable systemd-timesyncd
gpsinit -s 115200 -f /etc/gpsinit_time.conf /dev/serial0
python3 -m http.server
https://paulroberts69.wordpress.com/2022/08/02/interpreting-ntpq-output/
### NTPSEC CONF
# /etc/ntpsec/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntpsec/ntp.drift
leapfile /usr/share/zoneinfo/leap-seconds.list
# To enable Network Time Security support as a server, obtain a certificate
# (e.g. with Let's Encrypt), configure the paths below, and uncomment:
# nts cert CERT_FILE
# nts key KEY_FILE
# nts enable
# You must create /var/log/ntpsec (owned by ntpsec:ntpsec) to enable logging.
statsdir /var/log/ntpsec/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
# This should be maxclock 7, but the pool entries count towards maxclock.
tos maxclock 11
# Comment this out if you have a refclock and want it to be able to discipline
# the clock by itself (e.g. if the system is not connected to the network).
# tos minclock 4 minsane 3
# MIKE STYNE YOU COMMENTED THIS OUT TO TEST NOSELECT ^^^^
# Specify one or more NTP servers.
# Public NTP servers supporting Network Time Security:
# server time.cloudflare.com nts
# Server from shared memory provided by gpsd
server 127.127.28.0 minpoll 4 maxpoll 4 prefer
fudge 127.127.28.0 time1 +0.500 refid GPS stratum 2
# Kernel-mode PPS ref-clock for the precise seconds
server 127.127.22.0 minpoll 4 maxpoll 4
fudge 127.127.22.0 refid PPS
#fudge 127.127.22.0 time1 +0.000017 refid PPS
# pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will
# pick a different set every time it starts up. Please consider joining the
# pool: <https://www.pool.ntp.org/join.html>
# pool 0.us.pool.ntp.org iburst noselect
# pool 1.us.pool.ntp.org iburst noselect
# pool 2.us.pool.ntp.org iburst noselect
# pool 3.us.pool.ntp.org iburst noselect
server time-d-g.nist.gov iburst noselect
server time.cloudflare.com iburst noselect
# Access control configuration; see /usr/share/doc/ntpsec-doc/html/accopt.html
# for details.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.
# By default, exchange time with everybody, but don't allow configuration.
restrict default kod nomodify nopeer noquery limited
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
### GPSD CONF
# Devices gpsd should collect to at boot time.
# They need to be read/writeable, either by user gpsd or the group dialout.
DEVICES="/dev/serial0 /dev/pps0"
# Other options you want to pass to gpsd
GPSD_OPTIONS="-n"
# Automatically hot add/remove USB GPS devices via gpsdctl
USBAUTO="true"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment