]> zdv.bktei.com Git - EVA-2020-02.git/blobdiff - doc/time/README.org
feat(doc/time/README):Add instructions setting up chrony client
[EVA-2020-02.git] / doc / time / README.org
index e662695684b433c2da98b19b2adf793a264c30be..b3a05e9d22d9e2c00ee3eefd99a9d02f4890e908 100644 (file)
@@ -1,19 +1,21 @@
+* Ninfacyzga-1 Time Tracking
 #+TITLE: Ninfacyzga-1 Time Tracking
 #+AUTHOR: Steven Baltakatei Sandoval
 #+EMAIL: baltakatei@gmail.com
 #+TITLE: Ninfacyzga-1 Time Tracking
 #+AUTHOR: Steven Baltakatei Sandoval
 #+EMAIL: baltakatei@gmail.com
-* Time Tracking
+#+DATE: 2023-03-14
+
 ** About
 This document was created by Steven Baltakatei Sandoval on
 ** About
 This document was created by Steven Baltakatei Sandoval on
-~2020-07-23T22:27Z~ under a [[https://creativecommons.org/licenses/by-sa/4.0/][Creative Commons BY-SA 4.0 license]]. It
-was updated by Steven Baltakatei Sandoval on ~2020-10-16T22:26Z~
+~2020-07-23T22:27+00~ under a [[https://creativecommons.org/licenses/by-sa/4.0/][Creative Commons BY-SA 4.0 license]]. It
+was updated by Steven Baltakatei Sandoval on ~2023-03-14T19:47+00~.
 
 ** Narrative
 The ~ninfacyzga-01~ device is equipped with an Ozzmaker BerryGPS-IMU
 
 ** Narrative
 The ~ninfacyzga-01~ device is equipped with an Ozzmaker BerryGPS-IMU
-module which provides time and location data to ~gpsd~ and ~ntpsec~. The
-time is provided by GPS satellites which themselves are
+module which provides time and location data to ~gpsd~ and
+~chrony~. The time is provided by GPS satellites which themselves are
 equipped [fn:nasa_20020408_atomicclock] with atomic clocks. This
 equipped [fn:nasa_20020408_atomicclock] with atomic clocks. This
-extremely accurate set of clocks are needed since a GPS receiver
-calculates its position in space using a General Relativity
+extremely accurate set of clocks is needed since a GPS receiver
+determines its position in space using a [[https://en.wikipedia.org/wiki/Error_analysis_for_the_Global_Positioning_System#Special_and_general_relativity][General Relativity]]
 calculation that uses the small variations in the time stamps received
 from each satellite. This means that ~gpsd~ may be used to set the
 system clock without a need for an internet connection to a default
 calculation that uses the small variations in the time stamps received
 from each satellite. This means that ~gpsd~ may be used to set the
 system clock without a need for an internet connection to a default
@@ -27,23 +29,26 @@ Date:2002-04-08; Website:NASA.gov; [[https://web.archive.org/web/20100429141752/
 *** Hardware
 Ozzmaker BerryGPS-IMU, Version 3 (see [[https://ozzmaker.com/berrygps-berrygps-imu-quick-start-guide/][ref]]).
 *** Software
 *** Hardware
 Ozzmaker BerryGPS-IMU, Version 3 (see [[https://ozzmaker.com/berrygps-berrygps-imu-quick-start-guide/][ref]]).
 *** Software
+- [[https://www.raspberrypi.org/downloads/raspberry-pi-os/][Raspberry Pi OS]] : A GNU/Linux operating system derived from
+  Debian 10. This procedure was developed with version ~August 2020~.
+
 - [[https://tracker.debian.org/pkg/gpsd][~gpsd~]] : A background daemon app capable of interfacing with the
   [[https://ozzmaker.com/berrygps-berrygps-imu-quick-start-guide/][Ozzmaker BerryGPS-IMU]]'s GPS submodule. Installed and initialized by
   ~apt~. Should be installed along with the ~gpsd-clients~
   package. This procedure was developed with ~gpsd~ version
 
 - [[https://tracker.debian.org/pkg/gpsd][~gpsd~]] : A background daemon app capable of interfacing with the
   [[https://ozzmaker.com/berrygps-berrygps-imu-quick-start-guide/][Ozzmaker BerryGPS-IMU]]'s GPS submodule. Installed and initialized by
   ~apt~. Should be installed along with the ~gpsd-clients~
   package. This procedure was developed with ~gpsd~ version
 
-- [[https://tracker.debian.org/pkg/ntpsec][~ntpsec~]] : A security-hardned version of [[https://tracker.debian.org/pkg/ntp][~ntp~]] which is a "[[https://en.wikipedia.org/wiki/Network_Time_Protocol][Network
-  Time Protocol]]" app that synchronizes the system clock with local or
-  remote time servers or devices. It is capable of extracting time
-  data from a GPS signal handled by ~gpsd~. It is also capable of
-  using the high precision PPS (pulse-per-second) signal handled by
-  ~gpsd~. Installed via ~apt~. This procedure was developed with
-  ~ntpsec~ version ~1.1.3~.
+- [[https://chrony.tuxfamily.org/][~chrony~]] : A set of programs capable of continuously adjusting the
+  system clock until it is synchronized with configurable time sources
+  such as GPS and PPS data provided by ~gpsd~. ~chrony~ may be
+  configured to act as an NTP time client or server. It uses the same
+  protocol as ~ntp~ but is a GPLv2 implementation. This procedure was
+  developed with ~chrony~ version ~3.4-4~.
 
 ** Operating Procedures
 *** Initial Startup
 **** Perform initial setup.
 See [[file:../setup/README.org][Main Setup]] procedure.
 
 ** Operating Procedures
 *** Initial Startup
 **** Perform initial setup.
 See [[file:../setup/README.org][Main Setup]] procedure.
+
 **** Install Hardware for time tracking
 See [[https://ozzmaker.com/forums/topic/connecting-gps-pps-pin/][this]] Ozzmaker forum topic about connecting the BerryGPS-IMU
 ~T_PULSE~ pin to GPIO 18.
 **** Install Hardware for time tracking
 See [[https://ozzmaker.com/forums/topic/connecting-gps-pps-pin/][this]] Ozzmaker forum topic about connecting the BerryGPS-IMU
 ~T_PULSE~ pin to GPIO 18.
@@ -63,7 +68,7 @@ recommended, see this [[https://raspberryautomation.com/connect-multiple-ds18b20
 
 **** Install Software for time tracking
 The time tracking function can be performed by two programs: ~gpsd~
 
 **** Install Software for time tracking
 The time tracking function can be performed by two programs: ~gpsd~
-and ~ntpsec~.
+and ~chrony~.
 
 Basically, two things need to happen:
 
 
 Basically, two things need to happen:
 
@@ -71,15 +76,15 @@ Basically, two things need to happen:
    incoming GPS data (in NMEA format) and the PPS signal ("pulse per
    second"; a high precision time signal).
 
    incoming GPS data (in NMEA format) and the PPS signal ("pulse per
    second"; a high precision time signal).
 
-2. ~ntpsec~ needs to be pointed towards the correct local IP addresses
+2. ~chrony~ needs to be pointed towards the correct local IP addresses
    where ~gpsd~ provides GPS data and the PPS signal.
 
    where ~gpsd~ provides GPS data and the PPS signal.
 
-~gpsd~ then will provide GPS and PPS data to ~ntpsec~ via a "shared
+~gpsd~ then will provide GPS and PPS data to ~chrony~ via a "shared
 memory driver".
 
 ***** Install packages via ~apt~
 Run the following command to install the required packages.
 memory driver".
 
 ***** Install packages via ~apt~
 Run the following command to install the required packages.
-: $ sudo apt install gpsd gpsd-clients python-gps pps-tools ntpsec
+: $ sudo apt install gpsd gpsd-clients python-gps pps-tools chrony
 
 ***** Enable PPS device
 Modify the ~/boot/config.txt~ file in order to tell the Raspberry Pi
 
 ***** Enable PPS device
 Modify the ~/boot/config.txt~ file in order to tell the Raspberry Pi
@@ -87,6 +92,7 @@ to expect PPS data on ~BCM 18~ (pin number 12; see [[https://pinout.xyz/][link]]
 by adding the following line to ~/boot/config.txt~ as described on
 [[https://ozzmaker.com/forums/topic/problems-with-pps-on-a-pi0w-running-raspian-and-attached-to-a-berrygps-imuv3/][this Ozzmaker page]]:
 
 by adding the following line to ~/boot/config.txt~ as described on
 [[https://ozzmaker.com/forums/topic/problems-with-pps-on-a-pi0w-running-raspian-and-attached-to-a-berrygps-imuv3/][this Ozzmaker page]]:
 
+: # Enable PPS on GPIO 18
 : dtoverlay=pps-gpio,gpiopin=18
 
 The ~/boot/config.txt~ file can be modified via:
 : dtoverlay=pps-gpio,gpiopin=18
 
 The ~/boot/config.txt~ file can be modified via:
@@ -114,21 +120,13 @@ Note: For older Raspberry Pi models, it may be necessary to enable
 The Ozzmaker BerryGPS-IMU makes NMEA sentences available via the
 serial "UART" device ~/dev/ttyAMA0~. If bluetooth has not been
 disabled, the Raspberry Pi OS automatically creates a software "UART"
 The Ozzmaker BerryGPS-IMU makes NMEA sentences available via the
 serial "UART" device ~/dev/ttyAMA0~. If bluetooth has not been
 disabled, the Raspberry Pi OS automatically creates a software "UART"
-device at ~/dev/serial0~. See the "[[file:~/git-OC/ninfacyzga-01/doc/setup/README.org::*Disable%20Bluetooth][Disable Bluetooth]]" section in the
+device at ~/dev/serial0~. See the "[[file:../setup/README.org::*Disable%20Bluetooth][Disable Bluetooth]]" section in the
 [[file:../setup/README.org][Main Setup]] Initial Startup procedure for instructions on how to
 disable bluetooth to free up ~/dev/ttyAMA0~ for use by ~gpsd~.
 
 [[file:../setup/README.org][Main Setup]] Initial Startup procedure for instructions on how to
 disable bluetooth to free up ~/dev/ttyAMA0~ for use by ~gpsd~.
 
-Note: Older ~ntp~ documentation indicates that ~ntp~ (and presumably
-~ntpsec~ might be able to access GPS data (ex: NMEA sentences) without
-the aid of ~gpsd~ itself if the data is available at a device named
-~/dev/ggp0~. Similarly, the same might apply to PPS data and the
-~/dev/gpspps0~ device. However, since the Raspberry Pi OS overlay
-system automatically creates ~/dev/pps0~ using the modifications to
-~/boot/config.txt~ (described [[*Enable PPS device][elsewhere]] in this procedure).
-
 ***** Setup ~gpsd~
 ***** Setup ~gpsd~
-See the "[[file:~/git-OC/ninfacyzga-01/doc/location/README.org::*Setup%20~gpsd~][Setup ~gpsd~]]" subsection within the "Initial Startup" section
-of the Location Logging [[file:~/git-OC/ninfacyzga-01/doc/location/README.org][~README.org~]] file. There is one additional
+See the "[[file:../location/README.org::*Setup%20~gpsd~][Setup ~gpsd~]]" subsection within the "Initial Startup" section
+of the Location Logging [[file:../location/README.org][~README.org~]] file. There is one additional
 change that must be made which is to add a ~/dev/pps0~ item to the
 ~DEVICES=~ line in ~/etc/default/gpsd~ like so:
 
 change that must be made which is to add a ~/dev/pps0~ item to the
 ~DEVICES=~ line in ~/etc/default/gpsd~ like so:
 
@@ -148,181 +146,100 @@ DEVICES="/dev/ttyAMA0 /dev/pps0"
 GPSD_OPTIONS="-n"
 #+END_EXAMPLE
 
 GPSD_OPTIONS="-n"
 #+END_EXAMPLE
 
-***** Setup ~ntpsec~
-The ~ntpsec~ configuration file at ~/etc/ntpsec/ntp.conf~ must be
-modified to tell ~ntpsec~ how to retrieve and interpret the GPS and
-PPS data provided by ~gpsd~.
+Make sure to enable ~gpsd~ to automatically start as a system service.
+
+: $ sudo systemctl enable gpsd
+: $ sudo systemctl start gpsd
 
 
-In summary, lines need to be added telling ~ntpsec~ how often to poll
-certain sources (local or remote) for time information as well as how
-to prioritize and label information from each source.
+***** Setup ~chrony~
+Modify the configuration file for ~chrony~ at ~/etc/chrony/chrony.conf~.
 
 
-~ntpsec~ uses syntax simplified from that of ~ntp~. Specifically, it
-recommends use of the ~refclock~ keyword for configuring local
-hardware clocks such as GPS and PPS devices.
+: $ sudo nano /etc/chrony/chrony.conf
 
 
-Below is an example of lines that may be added to
-~/etc/ntpsec/ntp.conf~ in order to ensure that the system clock will always have 
+Add the following lines:
 
 #+BEGIN_EXAMPLE
 
 #+BEGIN_EXAMPLE
-# Local time sources
+# Get time from GPS (/dev/XXXX) and PPS (/dev/YYYY)
+#refclock SOCK /run/chrony.XXXX.sock refid GPS precision 1e-1 offset 0.0000
+#refclock SOCK /run/chrony.YYYY.sock refid PP precision 1e-7
+refclock SHM 0 refid GPS precision 1e-1 offset 0.0000 delay 0.2 stratum 1
+refclock SHM 1 refid PPS precision 1e-7 stratum 1
+#+END_EXAMPLE
 
 
-# Kernel PPS (precision seconds; driver 22)
-refclock pps unit 0 refid kPPS flag3 1 minpoll 4 maxpoll 4 stratum 1
+Where
+- ~XXXX~ : the basename of the GPS device's serial port. In this guide
+  it should be ~ttyAMA0~; other setups may use ~ttyS0~, ~ttyACM0~, or
+  ~serial0~.
 
 
-# GPS PPS reference (precision seconds; driver 28; root) (NTP1)
-refclock shm unit 1 refid PPS minpoll 4 maxpoll 4 iburst stratum 1
+- ~YYYY~ : the basename of the PPS device's serial port. In this guide
+  it should be ~pps0~.
 
 
-# GPS Serial data reference (coarse time; driver28; root) (NTP0)
-refclock shm unit 0 refid GPS prefer time1 0.109 minpoll 4 maxpoll 4 iburst stratum 1
+Note: The ~refclock SOCK~ lines are left as comments in case ~gpsd~
+incorrectly maps the GPS and PPS data.
 
 
-# GPS PPS reference (precision seconds; driver 28; user) (NTP2)
-refclock shm unit 2 refid PPSuser minpoll 4 maxpoll 4 iburst stratum 1
+The following commands may be useful for testing ~gpsd~ and ~chrony~
+configurations.
+- ~chronyc sources -v~ : Shows time sources and associated accuracy
+  information.
 
 
-# Tolerate outliers (useful for coarse clocks)
-tos mindist 0.500
-#+END_EXAMPLE
+- ~chronyc tracking~ : Shows the current time difference between
+  the reference clock and the system clock. Note: ~chrony~ gradually
+  attempts to reduce the difference by changing the system clock.
+
+- ~sudo chronyc makestep~ : Force ~chrony~ to set the system clock to
+  match the reference clock immediately.
+
+- ~sudo systemctl enable chrony~ : Enable automatic startup of
+  ~chrony~ (Note: This command shouldn't be necessary since the act of
+  installing ~chrony~ via ~sudo apt install chrony~ should
+  automatically enable it).
 
 
-A complete working example of an ~ntp.conf~ file is found in Appendix
-A of this document.
+- ~sudo systemctl stop chrony~ : Stop ~chrony~.
 
 
-Commands useful for examining the shared memory driver used by ~gpsd~
-and ~ntpsec~ are:
+- ~sudo systemctl restart chrony~ : Restart ~chrony~.
+
+- ~systemctl status chrony~ : Check status of ~chrony~ service.
 
 - ~sudo ntpshmmon~ : Shows live output of data using the shared memory
 
 - ~sudo ntpshmmon~ : Shows live output of data using the shared memory
-  driver. ([[https://gpsd.gitlab.io/gpsd/gpsd-time-service-howto.html][ref]])
+  driver filled by ~gpsd~. ([[https://gpsd.gitlab.io/gpsd/gpsd-time-service-howto.html][ref]])
 
 - ~sudo ipcs -m~ : Show live segments of the shared memory. ([[https://gpsd.gitlab.io/gpsd/gpsd-time-service-howto.html][ref]])
 
 
 - ~sudo ipcs -m~ : Show live segments of the shared memory. ([[https://gpsd.gitlab.io/gpsd/gpsd-time-service-howto.html][ref]])
 
-General references for this configuration file are:
-
-- "Raspberry Pi as a Stratum-1 NTP Server - Updating to the final NTP
-  configuration file" by David Taylor. [[http://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html#ntp-conf][Link]]. Date: 2020-03-24. Note:
-  An example of kernel PPS transfer from ~gpsd~ to ~ntp~ via
-  ~127.127.22.0~.
-
-- "GPSD Time Service HOWTO" by Garry E. Miller. [[https://gpsd.gitlab.io/gpsd/gpsd-time-service-howto.html][Link]]. Date:
-  2020-06-28. Note: Explains how shared memory segments available at
-  ~127.127.28.0~, ~127.127.28.1~, ~127.127.28.2~, etc. work in context
-  of an ~ntp~ configuration file.
-
-- "Building a Stratum 1 NTP Server with a Raspberry Pi 4 and Adafruit
-  Ultimate GPS Hat". [[http://www.gregledet.net/computers/building-a-stratum-1-ntp-server-with-a-raspberry-pi-4-and-adafruit-ultimate-gps-hat/][Link]]. Date: 2020-02-23. Note: A concise example
-  between ~gpsd~ and ~ntp~ setup for a Raspberry Pi 4 using
-  ~127.127.28.0~ and ~127.127.28.1~. Recommends use of ~ntpsec~
-  instead of ~ntp~.
-
-Expalantions of some ~ntpsec~ [[https://docs.ntpsec.org/latest/comdex.html][commands and options]] used in the
-configuration file include:
-
-- ~refclock~ : An ~ntpsec~ keyword not present in ~ntp-4.2.8~ that is
-  meant to simplify configuration of reference clocks that use certain
-  [[https://docs.ntpsec.org/latest/refclock.html][drivers]] including ~pps~ ([[https://docs.ntpsec.org/latest/driver_pps.html][PPS Clock Discipline]]), ~shm~ ([[https://docs.ntpsec.org/latest/driver_shm.html][Shared Memory
-  Driver]]) . In ~ntp-4.2.8~ and earlier, in order to configure a clock,
-  instead of ~ntpsec~'s one keyword (~refclock~), two keywords would
-  be required (~server~ and ~fudge~).
-
-- ~server [address]~ : Tells ~ntpsec~ the address to query for time
-  information. May be IP address or URL. Additional options such as
-  ~minpoll~, ~maxpoll~, ~prefer~, and ~true~ may be added.
-
-- ~prefer~ : Indicates the source should be prioritized in some
-  way. How exactly the ~ntpsec~ mitigation rules (see [[https://docs.ntpsec.org/latest/prefer.html][ref]]) use the
-  ~prefer~ option is complicated but in the context of dealing with a
-  GPS source and a PPS source, the GPS source should have a ~prefer~
-  option. The PPS source may have a ~prefer~ option but it is not
-  necessary; adding ~prefer~ to a PPS source is useful in the corner
-  case that the GPS source is less reliable than another source (ex: a
-  remote clock specified by ~server~).
-
-- ~... shm ... flag1 1~ : For an ~shm~ driver, tells ~ntpsec~ to
-  ignore the default sanity check that discards any time that is more
-  than 4-hours off from the system clock. Note that ~ntpsec~ treats
-  ~shm flag1 1~ in the opposite manner as ~ntp~ (see [[https://docs.ntpsec.org/latest/driver_shm.html][ref]]).
-
-- ~... shm ... time1 [float]~ : Tells ~ntpsec~ that a latency
-  time of ~[float]~ seconds is required for data to travel from the
-  address to ~ntpsec~ (ex: a USB hub in the case of a GPS device that
-  connects via USB). (see [[https://gpsd.gitlab.io/gpsd/gpsd-time-service-howto.html#_feeding_ntpd_from_gpsd][ref]]) This number of seconds should be
-  adjusted to reduce the `offset` time of the address indicated in the
-  output of the ~ntpq -pn~ command to near ~0.000~. Note that the
-  units of ~offset~ displayed by ~ntpq -pn~ are in milliseconds.
-
-- ~... refid [string]~ : Tells ~ntpsec~ a string used to label the source.
-
-- ~fudge~ : An ~ntp~ keyword that ~ntpsec~ developers do not recommend
-  using; ~ntpsec~ documentation for ~fudge~ is widthdrawn. For local
-  hardware providing GPS and PPS time information, ~fudge~ can mostly
-  be replaced with use of the ~refclock~ keyword instead.
-
-- ~fudge [address]~ : Tells ~ntpsec~ to consider additional options
-  when evaluating the accuracy of time from a given address.
-
-- ~fudge [address] ... flag3 1~ : An option that tells ~ntpsec~ to
-  enable "kernel PPS discipline" when interpreting the PPS signal at
-  the address. (see [[http://doc.ntp.org/4.2.8p7/drivers/driver22.html][ref]]).
-
-- ~stratum 1~ : Tells ~ntpsec~ to label the source as a "stratum 1"
-  time server. This means that it is a clock using NTP that is a
-  canonical (?) time source. For example, a stratum 0 NTP time server
-  would be an atomic clock. A stratum 1 NTP time server could be a
-  clock that uses a GPS receiver to synchronize to said atomic clock.
-
-- ~iburst~ : Tells ~ntpsec~ how often to query a source.
-
-- ~fudge [address] ... flag1 [float]~ : See description of ~... shm
-  ... time1 [float]~.
-
-- ~tos mindist [float]~ : Tells ~ntpsec~ to increase the tolerance for
-  outliers in the clock selection algorithm. Units of ~[float]~ are
-  seconds. The default value is ~0.001~ seconds. This [[http://doc.ntp.org/4.2.6/miscopt.html][reference]]
-  indicates that it is acceptable to raise this value for "clocks with
-  high jitter and a PPS signal". For the device being configured in
-  this guide, this is the case. ~ntpsec~ receives a kernel PPS signal
-  on ~127.127.22.0~ indicating when each second occurs but without
-  information about which second of the day is being ticked. ~ntpsec~
-  receives a coarse time from ~127.127.28.0~ supplied by ~gpsd~ that
-  is derived from the NMEA sentences generated by the GPS receiver;
-  this coarse time (high jitter) lacks the precision of the PPS signal
-  since NMEA sentence transmission times are not well-controlled.
-
-****** Disable DHCP services affecting ~ntpsec~
-Some processes that use [[https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol][DHCP]] (Dynamic Host Configuration Protocol) may
-cause configuration changes to configuration files of ~ntp~. Since
-~ntpsec~ is similar to ~ntp~, it is reasonable to take action to
-prevent this.
-
-Remove some files:
-
-: $ sudo rm /etc/dhcp/dhclient-exit-hooks.d/ntp
-: $ sudo rm /lib/dhcpcd/dhcpcd-hooks/50-ntp.conf
-
-In the "request" block of ~dhclient.conf~, remove ~dhcp6.sntp-servers~
-and ~ntp-servers~.
-
-: $ sudo nano /etc/dhcp/dhclient.conf
-
-For example, the following section of ~dhclient.conf~:
+- ~sudo date -s '2020-07-07T00:00+0000'~ : Manually sets time to a
+  string.
+
+An example output of ~sudo chronyc sources -v~ will show something
+similar to this:
 
 #+BEGIN_EXAMPLE
 
 #+BEGIN_EXAMPLE
-send host-name = gethostname();
-request subnet-mask, broadcast-address, time-offset, routers,
-        domain-name, domain-name-servers, domain-search, host-name,
-        dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
-        netbios-name-servers, netbios-scope, interface-mtu,
-        rfc3442-classless-static-routes, ntp-servers;
+pi@ninfacyzga-1-x:~ $ sudo chronyc sources -v
+210 Number of sources = 6
+
+  .-- 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                           1   4   377    21   +110ms[ +110ms] +/-  200ms
+#* PPS                           1   4   377    22  +2496ns[+3045ns] +/- 1000ns
+^- vps-2d3ddab6.vps.ovh.ca       2   6   277    57  +1302us[+1304us] +/-  151ms
+^? time.richiemcintosh.com       2   6     1    59  +2626us[+2628us] +/-   92ms
+^- varuna.ga-group.nl            3   6   377    55  -3962us[-3960us] +/-  151ms
+^- ntp3.junkemailfilter.com      2   6   377    58  -4561us[-4558us] +/-   80ms
 #+END_EXAMPLE
 
 #+END_EXAMPLE
 
-should be changed to:
+General references for the ~chrony.conf~ file are:
 
 
-#+BEGIN_EXAMPLE
-send host-name = gethostname();
-request subnet-mask, broadcast-address, time-offset, routers,
-        domain-name, domain-name-servers, domain-search, host-name,
-        dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn,
-        netbios-name-servers, netbios-scope, interface-mtu,
-        rfc3442-classless-static-routes;
-#+END_EXAMPLE
+- The ~chrony~ ~4.0~ documentation. ([[https://chrony.tuxfamily.org/doc/4.0/chrony.conf.html][ref]])
+
+- The ~gpsd~ documentation for communicating with ~chrony~. ([[https://gpsd.gitlab.io/gpsd/gpsd-time-service-howto.html#_feeding_chrony_from_gpsd][ref]])
+
+- Setup guide for a USB GPS with ~gpsd~ and ~chrony~. ([[https://photobyte.org/raspberry-pi-stretch-gps-dongle-as-a-time-source-with-chrony-timedatectl/][ref]])
 
 ***** Disable CPU power saving
 Power saving featurs of the Raspberry Pi Zero W may also be disabled
 
 ***** Disable CPU power saving
 Power saving featurs of the Raspberry Pi Zero W may also be disabled
@@ -369,112 +286,104 @@ nohz=off
 
 [fn:se_20180320_raspicpugov] Title:[[https://raspberrypi.stackexchange.com/questions/9034/how-to-change-the-default-governor]["How to change the default governor?"]]; Author:[[https://raspberrypi.stackexchange.com/users/5538/goldilocks][goldilocks]]; Date: 2018-03-20; Website:stackexchange.com;
 
 
 [fn:se_20180320_raspicpugov] Title:[[https://raspberrypi.stackexchange.com/questions/9034/how-to-change-the-default-governor]["How to change the default governor?"]]; Author:[[https://raspberrypi.stackexchange.com/users/5538/goldilocks][goldilocks]]; Date: 2018-03-20; Website:stackexchange.com;
 
+***** Configure another machine to use the time server
+A separate Debian machine may be configured to use the ~ninfacyzga-1~
+device as a GPS time server. This may be performed by:
+
+1. Installing ~chrony~ onto the separate machine (e.g. hostname
+   ~somedeb~):
+
+#+begin_example
+somedeb:$ sudo apt update && sudo apt upgrade
+somedeb:$ sudo apt install chrony
+#+end_example
+
+2. Modifying the ~chrony.conf~ file:
+
+  : somedeb:$ emacs /etc/chrony/chrony.conf
+
+  - Add the following lines to the end of this configuration file,
+    substituting ~ninfacyzga-1-x~ with the hostname or IP address
+    chosen for the ~ninfacyzga-1~ device:
+
+#+begin_example
+# Use ninfacyzga-1-x if available
+server ninfacyzga-1-x iburst prefer minpoll 2 maxpoll 4
+#+end_example
+
+3. Restart the ~chrony~ service.
+
+  : somedeb:$ sudo systemctl restart chrony
+
+4. Verify that ~ninfacyzga-1-x~ is being used by ~chrony~ 
+
+#+begin_example
+somedeb:$ chronyc sources
+MS Name/IP address         Stratum Poll Reach LastRx Last sample               
+===============================================================================
+^? pugot.canonical.com           2   6   377    11  -2172us[-2209us] +/-  115ms
+^? prod-ntp-5.ntp4.ps5.cano>     2   6   377     9  -4169us[-4206us] +/-   88ms
+^? prod-ntp-4.ntp1.ps5.cano>     2   6   377    10  -2758us[-2795us] +/-   88ms
+^? prod-ntp-3.ntp1.ps5.cano>     2   6   377     5  -6473us[-6510us] +/-   87ms
+^? mail.novg.net                 2   6   377    11  -6099us[-6136us] +/-  125ms
+^? ntp1a.versadns.com            1   6   377     6  -2006us[-2043us] +/-   40ms
+^? 2602:fde5:2a::12              1   6   377    11  -2200us[-2237us] +/-   49ms
+^? 2001:da8:9000::130            1   6   377    15  -2372us[-2409us] +/-  102ms
+^* ninfacyzga-1-x.lan            2   4   377    14  -1686us[-1724us] +/- 2971us
+^- brazil.time.system76.com      2   6   377    17  -4738us[-4775us] +/-  103ms
+^- ohio.time.system76.com        2   6   377    15   +320us[ +283us] +/-   58ms
+^- oregon.time.system76.com      2   6   377    19  -5845us[-5882us] +/-   30ms
+^- paris.time.system76.com       2   6   377    19  -4531us[-4568us] +/-   92ms
+^- virginia.time.system76.c>     2   6   377    15  -6607us[-6644us] +/-   51ms
+#+end_example
+
+  The ~*~ in the ~^*~ symbol at the start of the line containing
+  ~ninfacyzga-1-x~ indicates that ~ninfacyzga-1-x~ is being used to
+  set the system clock of ~somedeb~.
+
 *** Normal Startup
 *** Normal Operation
 *** Normal Shutdown
 *** Unscheduled Shutdown
 ** Appendix A
 *** Normal Startup
 *** Normal Operation
 *** Normal Shutdown
 *** Unscheduled Shutdown
 ** Appendix A
-*** Example ~ntp.conf~ for ~ntpsec~
-Below is an example ~ntp.conf~ file for use with ~ntpsec~.
+*** Example ~chrony.conf~ for ~chrony~
+For Raspberry Pi OS, the configuration file should be installed at
+~/etc/chrony/chrony.conf~.
 
 #+BEGIN_EXAMPLE
 
 #+BEGIN_EXAMPLE
-# /etc/ntpsec/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
-
-# Drift file
-driftfile /var/lib/ntpsec/ntp.drift
+# Welcome to the chrony configuration file. See chrony.conf(5) for more
+# information about usuable directives.
+pool 2.debian.pool.ntp.org iburst
 
 
-# Leap seconds definition provided by tzdata
-leapfile /usr/share/zoneinfo/leap-seconds.list
+# This directive specify the location of the file containing ID/key pairs for
+# NTP authentication.
+keyfile /etc/chrony/chrony.keys
 
 
-# Log file
-#logfile /var/log/ntp.log
+# 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
 
 
-# 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
+# Log files location.
+logdir /var/log/chrony
 
 
+# Stop bad estimates upsetting machine clock.
+maxupdateskew 100.0
 
 
-# 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
+# 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
 
 
-# Local time sources
-
-# Kernel PPS (precision seconds; driver 22)
-refclock pps unit 0 refid kPPS flag3 1 minpoll 4 maxpoll 4 stratum 1
-
-# GPS PPS reference (precision seconds; driver 28; root) (NTP1)
-refclock shm unit 1 refid PPS minpoll 4 maxpoll 4 iburst stratum 1
-
-# GPS Serial data reference (coarse time; driver28; root) (NTP0)
-refclock shm unit 0 refid GPS prefer time1 0.109 minpoll 4 maxpoll 4 iburst stratum 1
-
-# GPS PPS reference (precision seconds; driver 28; user) (NTP2)
-refclock shm unit 2 refid PPSuser minpoll 4 maxpoll 4 iburst stratum 1
-
-# Tolerate outliers (useful for coarse clocks)
-tos mindist 0.500
-
-
-# Specify one or more NTP servers.
-
-# 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>
-server time.nist.gov iburst
-server tick.usno.navy.mil iburst
-server 0.us.pool.ntp.org iburst
-#server 0.us.pool.ntp.org iburst
-#server 0.us.pool.ntp.org iburst
-#server 0.us.pool.ntp.org iburst
-pool 0.debian.pool.ntp.org iburst
-#pool 1.debian.pool.ntp.org iburst
-#pool 2.debian.pool.ntp.org iburst
-#pool 3.debian.pool.ntp.org iburst
-
-
-# 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
+# Get time from GPS (/dev/ttyAMA0) and PPS (/dev/pps0)
+#refclock SOCK /run/chrony.ttyAMA0.sock refid GPS precision 1e-1 offset 0.0000
+#refclock SOCK /run/chrony.pps0.sock refid PP precision 1e-7
+refclock SHM 0 refid GPS precision 1e-1 offset 0.0000 delay 0.2 stratum 1
+refclock SHM 1 refid PPS precision 1e-7 stratum 1
 #+END_EXAMPLE
 
 #+END_EXAMPLE
 
-* Discard
-
-** Transitional ntp to ntpsec config file snippet
-# Kernel PPS (precision seconds; driver 22)
-#server 127.127.22.0 minpoll 4 maxpoll 4 true
-#fudge 127.127.22.0 flag3 1 refid kPPS stratum 1
-refclock pps unit 0 refid kPPS flag3 1 minpoll 4 maxpoll 4 stratum 1
-
-# GPS PPS reference (precision seconds; driver 28; root) (NTP1)
-#server 127.127.28.1 minpoll 4 maxpoll 4 iburst
-#fudge 127.127.28.1 flag1 1 refid PPS
-refclock shm unit 1 refid PPS minpoll 4 maxpoll 4 iburst stratum 1
-
-# GPS Serial data reference (coarse time; driver28; root) (NTP0)
-#server 127.127.28.0 minpoll 4 maxpoll 4 iburst prefer
-#fudge 127.127.28.0 flag1 1 time1 0.109 refid GPS stratum 1
-refclock shm unit 0 refid GPS prefer time1 0.109 minpoll 4 maxpoll 4 iburst stratum 1
-
-# GPS PPS reference (precision seconds; driver 28; user) (NTP2)
-#server 127.127.28.2 minpoll 4 maxpoll 4 iburst
-#fudge 127.127.28.2 flag1 1 refid PPSuser stratum 1
-refclock shm unit 2 refid PPSuser minpoll 4 maxpoll 4 iburst stratum 1
-
-# Tolerate outliers (useful for coarse clocks)
-tos mindist 0.500