2

I tried to get more accurate time from gps data using ublox module and centos but it seems gpsd.sock does not work properly to get the data to chrony.

am I missing somthing ?

[root@info /]# cat /etc/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.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

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

allow

refclock SOCK /var/run/chrony.ttyS0.sock delay 0.5 refid GPS
refclock PPS /dev/pps0 lock NMEA refid PPS prefer trust

and there is no output in the chrony sources "GPS"

[root@info /]# chronyc sources 
210 Number of sources = 6
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
#? GPS                           0   4     0     -     +0ns[   +0ns] +/-    0ns
#* PPS                           0   4     0   311   -382ns[ -613ns] +/-  538ns
^- 162.159.200.1                 3   8   173    17  +8684us[+8684us] +/-   71ms
[root@info /]# cat /lib/systemd/system/gpsd.socket 
[Unit]
Description=GPS (Global Positioning System) Daemon Sockets

[Socket]
ListenStream=/var/run/gpsd.sock
ListenStream=0.0.0.0:2947
#SocketMode=0600
SocketMode=0755

[Unit]
Description=GPS (Global Positioning System) Daemon
Requires=gpsd.socket
# Needed with chrony SOCK refclock
After=chronyd.service


[Install]
Also=gpsd.socket
WantedBy=sockets.target
[root@info /]# cat /etc/systemd/system/multi-user.target.wants/gpsd.service
[Unit]
Description=GPS (Global Positioning System) Daemon
Requires=gpsd.socket
# Needed with chrony SOCK refclock
After=chronyd.service

[Service]
EnvironmentFile=-/etc/sysconfig/gpsd
ExecStart=/usr/sbin/gpsd -N -G $OPTIONS $DEVICES

[Install]
WantedBy=multi-user.target
Also=gpsd.socket
Bell-guest
  • 21
  • 2

1 Answers1

0

It looks like your refclock PPS line in /etc/chrony.conf is incorrect. it appears you're pointing it to the device when it should be pointed to where gpsd is expecting it, in the format it is expecting.

my two refclock socket lines look like this and it's working:

refclock SOCK /run/chrony.ttyUSB0.sock refid GPS precision 1e-1 offset 0.9999
refclock SOCK /run/chrony.pps0.sock    refid PPS precision 1e-7

your PPS line points to /dev/pps0. it's true, that's where it is, but that's not where you want Chrony to make the socket for gpsd to feed. that's what those two lines say. it's telling Chrony to make these two special socket files for gpsd to send data to. So you don't want Chrony to make a special socket file right on top of the real pps device in /dev/pps0.

This procedure is not simple and numerous online examples can be confisuing. the best step-by-step was right at the GPSD tutorial.

Marc Compere
  • 421
  • 4
  • 3