How to enable or disable NTP time synchronization on the Raspberry Pi
Disable NTP:
sudo systemctl disable --now systemd-timesyncd
Enable NTP:
sudo systemctl enable --now systemd-timesyncd
Verifying if NTP is active
You can verify if NTP is active or not by running
timedatectl
Then look for these lines:
System clock synchronized: yes
NTP service: active
System clock synchronized
will tell you if the NTP service has successfully synchronized the system time to a NTP time server: yes
if synchronized, no
if not synchronized.
NTP service
will tell you if the NTP service is running, i.e. if it is trying to synchronize the system time to a NTP time server: active
if running, inactive
when not running
Output with NTP active:
Local time: Tue 2023-03-14 16:49:28 CET
Universal time: Tue 2023-03-14 15:49:28 UTC
RTC time: Tue 2023-03-14 15:49:28
Time zone: Europe/Berlin (CET, +0100)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
Output with NTP inactive:
Local time: Tue 2023-03-14 16:48:01 CET
Universal time: Tue 2023-03-14 15:48:01 UTC
RTC time: Tue 2023-03-14 15:48:01
Time zone: Europe/Berlin (CET, +0100)
System clock synchronized: no
NTP service: inactive
RTC in local TZ: no