I'm not sure if the script you have found is useful at all: parsing the output of gpspipe
with a shell script is anything but fast. You'll most probably get worse clock accuracy using your script than you would by simply synchronizing with pool.ntp.org
(unless you don't have network connection at all, or use a modem).
Both ntpd
and chrony
can use GPS time source directly, if you tell them so in the config. For example, check out chrony
manual and search for refclock
. You'll see the examples of configuration for different kinds of GPS devices (PPS or NMEA). Note that PPS (pulse per second) GPS devices require an additional clock source to be configured, to tell which second has just elapsed. For example:
server pool.ntp.org refid NTP
refclock PPS /dev/pps0 lock NTP
This will fetch your time from the network as usual, but will constantly readjust it to pulses form the PPS device.
For a NMEA GPS, the config would be:
refclock SHM 1 poll 3 refid GPS1
Here is a nice tutorial which explains how GPS time servers work in greater detail.
Also check out this question.