Okay, so is your PI's clock in sync?
A PI does not have an onboard realtime clock so at each boot it MUST sync its system time from an online source.
This web site has some discussion and helpful hints on getting a PI to have accurate time, while some of the chatter on the page is not helpful, I will try to distill it down to what you need
https://raspberrypi.stackexchange.com/q ... after-boot
Warning: this is all done in the CONSOLE, buckle up and lets open a 'Terminal' session, lets see if the usual linux NTP (network time protocol) software is installed
Code: Select all
pi@vk5pj-pi: $ sudo /etc/init.d/ntp stop
sudo: /etc/init.d/ntp: command not found
pi@vk5pj-pi: $ sudo ntpd -q -g
sudo: ntpd: command not found
nope... the above code shows up the PI does not have this 'ntp' package installed.. hmmm
-------------------------
Okay lets make sure the normal PI time setting tools are there and working
Code: Select all
pi@vk5pj-pi:$ sudo timedatectl set-ntp True
pi@vk5pj-pi:$ timedatectl status
] Local time: Sun 2018-10-14 07:34:45 ACDT
Universal time: Sat 2018-10-13 21:04:45 UTC
RTC time: n/a
Time zone: Australia/Adelaide (ACDT, +1030)
Network time on: yes
NTP synchronized: yes
RTC in local TZ: no
That looks good, so maybe the original time set routine works okay BUT I believe this does not keep the clock in sync and only does a sync at boot. For Ham digital modes we may need to get more regular time syncs.. enter NTPd stage left..
Code: Select all
pi@vk5pj-pi:/etc $ sudo apt-get install ntp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libopts25
Suggested packages:
ntp-doc
The following NEW packages will be installed:
libopts25 ntp
0 upgraded, 2 newly installed, 0 to remove and 34 not upgraded.
Need to get 609 kB of archives.
After this operation, 1,826 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirror.internode.on.net/pub/raspbian/raspbian stretch/main armhf libopts25 armhf 1:5.18.12-3 [61.4 kB]
Get:2 http://mirror.internode.on.net/pub/raspbian/raspbian stretch/main armhf ntp armhf 1:4.2.8p10+dfsg-3+deb9u2 [548 kB]
Fetched 609 kB in 2s (217 kB/s)
Selecting previously unselected package libopts25:armhf.
(Reading database ... 157490 files and directories currently installed.)
Preparing to unpack .../libopts25_1%3a5.18.12-3_armhf.deb ...
Unpacking libopts25:armhf (1:5.18.12-3) ...
Selecting previously unselected package ntp.
Preparing to unpack .../ntp_1%3a4.2.8p10+dfsg-3+deb9u2_armhf.deb ...
Unpacking ntp (1:4.2.[code]
8p10+dfsg-3+deb9u2) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Processing triggers for systemd (232-25+deb9u4) ...
Setting up libopts25:armhf (1:5.18.12-3) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up ntp (1:4.2.8p10+dfsg-3+deb9u2) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Processing triggers for systemd (232-25+deb9u4) ...[/code]
Now we neet to edit the ntp.conf file to set which servers we should sync from.
Code: Select all
pi@vk5pj-pi:/etc $ sudo nano /etc/ntp.conf
once the 'nano' editor is on the screen, make these changes: add the bits in
Blue then comment out with a
# the bits in
red or if you like remove all the bits in red altogether as we want NTP to check servers closer to home.
# pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will
# pick a different set every time it starts up. Please consider joining the
# pool: <
http://www.pool.ntp.org/join.html>
server 0.au.pool.ntp.org
server 1.au.pool.ntp.org
server 2.au.pool.ntp.org
#pool 0.debian.pool.ntp.org iburst
#pool 1.debian.pool.ntp.org iburst
#pool 2.debian.pool.ntp.org iburst
#pool 3.debian.pool.ntp.org iburst
In the block below we can do a check that our settings in '/etc/ntp.conf' are okay by stopping the service and then running it manually. If you are ever wondering why a lot of Linux processes have a 'd' at the end of there names (ntpd vs ntp), this has become a standard to designate that this is a 'daemon' which means it is run by the system as a service and is not meant to be run interactively by the user.
Code: Select all
pi@vk5pj-pi:/etc $ service ntp stop
pi@vk5pj-pi:/etc $ sudo ntpd -gq
14 Oct 07:51:01 ntpd[9600]: ntpd 4.2.8p10@1.3728-o Sat Mar 10 18:03:33 UTC 2018 (1): Starting
14 Oct 07:51:01 ntpd[9600]: Command line: ntpd -gq
14 Oct 07:51:01 ntpd[9600]: proto: precision = 1.510 usec (-19)
14 Oct 07:51:01 ntpd[9600]: Listen and drop on 0 v6wildcard [::]:123
14 Oct 07:51:01 ntpd[9600]: Listen and drop on 1 v4wildcard 0.0.0.0:123
14 Oct 07:51:01 ntpd[9600]: Listen normally on 2 lo 127.0.0.1:123
14 Oct 07:51:01 ntpd[9600]: Listen normally on 3 eth0 192.168.0.165:123
14 Oct 07:51:01 ntpd[9600]: Listen normally on 4 lo [::1]:123
14 Oct 07:51:01 ntpd[9600]: Listen normally on 5 eth0 [fe80::5564:d983:f53b:2040%2]:123
14 Oct 07:51:01 ntpd[9600]: Listening on routing socket on fd #22 for interface updates
14 Oct 07:51:09 ntpd[9600]: ntpd: time slew -0.002948 s
ntpd: time slew -0.002948s
pi@vk5pj-pi:/etc $ sudo service ntp start
pi@vk5pj-pi:/etc $
Now I do expect I will have to fine tune my settings in the '/etc/ntp.conf' to get it to check sync a little more often but for today I have run out of time to look into that.