[LinuxPPS] chrony with LinuxPPS and gpsd

Miroslav Lichvar mlichvar at redhat.com
Tue Jun 22 13:00:54 CEST 2010


Here is a chrony+LinuxPPS+gpsd howto.

Get/compile a kernel with PPS support, the kernel consumer patches are
not needed.

Compile chrony (http://chrony.tuxfamily.org/). The refclock support
was added in the latest release 1.24, but I recommend using a current
git snapshot instead, there were some improvements related to
refclocks. The timepps.h file from pps-tools is required to compile
the PPS support.

$ git clone git://git.tuxfamily.org/gitroot/chrony/chrony.git
$ git clone git://git.enneenne.com/pps-tools
$ cd chrony
$ CPPFLAGS="-I../pps-tools" ./configure && make
# make install

In the configure output should be:   Checking for PPS API : Yes

Install a distribution gpsd package or compile from sources. Versions
2.90 and later work best.

Configure /etc/chrony.conf, here is an example for Garmin GPS 18x LVC
in NMEA mode, modify the offset value as needed:

refclock PPS /dev/pps0 lock SHM0
refclock SHM 0 offset 0.5 delay 0.2 refid SHM0

allow

#driftfile /var/lib/chrony/drift
#logdir /var/log/chrony
#log statistics tracking refclocks


Start gpsd and chronyd:
# /usr/sbin/gpsd -n /dev/ttyS0
# ldattach 18 /dev/ttyS0
# /usr/local/sbin/chronyd

Use chronyc sources, sourcestats and tracking commands to monitor chrony. If
everything is working correctly it should be similar to:

$ chronyc tracking
Reference ID    : 80.80.83.48 (PPS0)
Stratum         : 1
Ref time (UTC)  : Tue Jun 22 10:37:23 2010
System time     : 0.000000175 seconds slow of NTP time
Frequency       : 109.375 ppm fast
Residual freq   : -0.000 ppm
Skew            : 0.004 ppm
Root delay      : 0.000000 seconds
Root dispersion : 0.000000 seconds

$ chronyc sources
210 Number of sources = 2
MS Name/IP address           Stratum Poll LastRx Last sample
============================================================================
#* PPS0                          0    4     19    -59ns[  -79ns] +/-  181ns
#~ SHM0                          0    4     16    +21ms[  +21ms] +/-  103ms

$ chronyc sourcestats
210 Number of sources = 2
Name/IP Address            NP  NR  Span  Frequency  Freq Skew  Offset  Std Dev
==============================================================================
PPS0                       16   7   238     -0.000      0.004     -1ns   283ns
SHM0                       16   8   241   -180.264    132.329    +11ms  9416us

Please note that chrony currently can't make system clock adjustment below
microsecond due to adjtimex limitations, so there will be an extra 0-500ns
error (that's the system time offset in tracking output).

-- 
Miroslav Lichvar



More information about the LinuxPPS mailing list