How to use gpsd and chrony with an intermittant GPS signal

97 views Asked by At

When starting up a system with GPS it is often in a location where the GPS signal is obstructed but it will get signal at some later time. I have no internet connection or time servers available on my network. I would like chrony to server my system time from the hardware clock until the GPS becomes available but currently chrony accepts a time on Jan 6 1980 (GPS epoch) from the GPS and sets the HW clock to this value. I am running on Red Hat 7 but don't think this is specific to RHEL7.

Here is my current chrony.conf:

`# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.rhel.pool.ntp.org iburst maxpoll 16
#server 1.rhel.pool.ntp.org iburst maxpoll 16
#server 2.rhel.pool.ntp.org iburst maxpoll 16
#server 3.rhel.pool.ntp.org iburst maxpoll 16

#Use GPS reference clock
refclock SHM 0 refid GPS precision 1e-1 offset 0.9999 delay 0.2
refclock SHM 1 refid PPS precision 1e-7

# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift

# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3

# Enable kernel synchronization of the real-time clock (RTC).
rtcsync

# Enable hardware timestamping on all interfaces that support it.
#hwtimestamp *

# Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2

#Allow all NTP clients
allow

# Serve time even if not synchronized to a time source.
local stratum 10

# Specify file containing keys for NTP authentication.
#keyfile /etc/chrony.keys

# Specify directory for log files.
logdir /var/log/chrony

# Select which information is logged.
#log measurements statistics tracking`
1

There are 1 answers

0
John Trautwein On

I found that adding the following line to the chrony.conf prevents stepping the time if the change would be greater than 10 years:

maxchange 315360000 0 -1

There may be other solutions, but ths worked for me.