-
Notifications
You must be signed in to change notification settings - Fork 301
Time services
It is not possible to create a dependable data logging system without an accurate source of time. There are two parts of the problem:
- An onboard "real time clock" (RTC)
- A service that synchronizes the clock with a definitive time source on the internet.
This note is about the second part of that problem: using a time service. There are two common alternatives:
-
ntp
; -
systemd-timesyncd
, a light weight, client-only, alternative.
You should usually enable one or the other, but not both.
To see if your system is already running ntp
use
systemctl status ntp
On Debian systems, it can be easily installed using apt
:
sudo apt install ntp
Note that systemd may not reliably detect time synchronisation if ntp
is installed so you may need to consider issue #946
This is an alternative, available on operating systems using systemd. It has the advantage of being smaller and simpler. To see if you are already running systemd-timesyncd
:
systemctl status systemd-timesyncd
If not, it can be installed using apt
:
sudo apt install systemd-timesyncd
To see its status:
timedatectl status
To enable it:
sudo timedatectl set-ntp true
One nuance on most debian-based systems is that NTP will be used if it is installed and enabled even 'if' you have systemd time services also enabled, but in general you should disable the systemd time service if you want to use the standalone NTP daemon.