I have a Raspberry Pi that will be used for logging sensor data while not connected to the internet. Since the Raspberry Pi doesn't have an RTC, and to still get the actual time, I want to use a GPS receiver for the time. I would like to use gpsd and chrony to achieve this. I chose chrony, as it offers some advantages over ntpd that I'll be using later on.
I have installed gpsd and chrony from the Raspbian repository. My
START_DAEMON="true" USBAUTO="true" DEVICES="/dev/ttyACM0" GPSD_OPTIONS="-n"
gpsd works, I can verify that with
cgps (which says
Status: 3D FIX).
refclock SHM 0 offset 0.05 delay 0.5 refid SHM0 noselect makestep 1 10 maxupdateskew 5 local stratum 1 manual allow pidfile /tmp/chronyd.pid driftfile /var/lib/chrony/chrony.drift keyfile /etc/chrony/chrony.keys commandkey 1 logdir /var/log/chrony log tracking noclientlog logchange 0.1 dumponexit dumpdir /var/lib/chrony cmdallow 127.0.0.1 lock_all bindcmdaddress 127.0.0.1 bindcmdaddress ::1
Now I expect chrony to keep the date and time of my Raspberry Pi in sync. However, the result:
On my own pc:
$ date Mon 12 Dec 08:58:13 CET 2016
On my Raspberry Pi:
$ date Mon 12 Dec 16:11:39 GMT 2016
If I check on chrony, it does seem to get date from the
gpsd daemon, as shown by this table that lists an ~8 hour time difference, which seems about right:
$ chronyc sources 210 Number of sources = 1 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== #? SHM0 0 4 377 22 +29618s[+29618s] +/- 250ms
I can set the time with
$ sudo chronyc chrony version 1.30 Copyright (C) 1997-2003, 2007, 2009-2014 Richard P. Curnow and others chrony comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See the GNU General Public License version 2 for details. chronyc> password **** 200 OK chronyc> settime Dec 12, 2016 12:11:39 200 OK Clock was 15194.06 seconds fast. Frequency change = 0.00ppm, new frequency = 12.75ppm $ date Mon 12 Dec 12:11:44 GMT 2016
So why isn't
chronyd setting my system time by itself?