Checking status
Since Ubuntu 16.04 timesyncd which is part of systemd is now responsible (out of the box) for syncing date/time. You can check its status using systemctl:
$ systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
└─disable-with-time-daemon.conf
Active: active (running) since Sun 2018-08-05 10:14:44 EDT; 11min ago
Docs: man:systemd-timesyncd.service(8)
Main PID: 3714 (systemd-timesyn)
Status: "Synchronized to time server 108.59.2.24:123 (0.debian.pool.ntp.org)."
CGroup: /system.slice/systemd-timesyncd.service
└─3714 /lib/systemd/systemd-timesyncd
Aug 05 10:14:44 pi-hole systemd[1]: Starting Network Time Synchronization...
Aug 05 10:14:44 pi-hole systemd[1]: Started Network Time Synchronization.
Aug 05 10:14:45 pi-hole systemd-timesyncd[3714]: Synchronized to time server 108.59.2.24:123 (0.debian.pool.ntp.org).
Or through journalctl:
$ journalctl -u systemd-timesyncd
-- Logs begin at Thu 2016-11-03 13:16:42 EDT, end at Sun 2018-08-05 10:20:01 EDT. --
Aug 05 10:14:44 pi-hole systemd[1]: Starting Network Time Synchronization...
Aug 05 10:14:44 pi-hole systemd[1]: Started Network Time Synchronization.
Aug 05 10:14:45 pi-hole systemd-timesyncd[3714]: Synchronized to time server 108.59.2.24:123 (0.debian.pool.ntp.org).
You can also watch systemd/clock:
$ stat /var/lib/systemd/clock
File: /var/lib/systemd/clock
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: b302h/45826d Inode: 18750 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 100/systemd-timesync) Gid: ( 103/systemd-timesync)
Access: 2018-08-05 10:22:13.838262405 -0400
Modify: 2018-08-05 10:22:13.838262405 -0400
Change: 2018-08-05 10:22:13.838262405 -0400
Birth: -
The Access/Modify/Change times on this file show when systemd-timesynd last touched it.
Forcing a sync
It doesn't appear that there's any method to force a sync directly. Restarting the systemd-timesyncd service does in fact trigger a resync though:
$ systemctl restart systemd-timesyncd
You can see this in the logs:
$ journalctl -u systemd-timesyncd
-- Logs begin at Thu 2016-11-03 13:16:42 EDT, end at Sun 2018-08-05 10:44:37 EDT. --
Aug 05 10:14:44 pi-hole systemd[1]: Starting Network Time Synchronization...
Aug 05 10:14:44 pi-hole systemd[1]: Started Network Time Synchronization.
Aug 05 10:14:45 pi-hole systemd-timesyncd[3714]: Synchronized to time server 108.59.2.24:123 (0.debian.pool.ntp.org).
Aug 05 10:44:37 pi-hole systemd[1]: Stopping Network Time Synchronization...
Aug 05 10:44:37 pi-hole systemd[1]: Stopped Network Time Synchronization.
Aug 05 10:44:37 pi-hole systemd[1]: Starting Network Time Synchronization...
Aug 05 10:44:37 pi-hole systemd[1]: Started Network Time Synchronization.
Aug 05 10:44:37 pi-hole systemd-timesyncd[4157]: Synchronized to time server 208.75.88.4:123 (0.debian.pool.ntp.org).
The last line is from my restart.
Controlling interval
You can control the interval which this polls the NTP servers through these properties in the systemd-timesyncd config file /etc/systemd/timesyncd.conf:
PollIntervalMinSec=, PollIntervalMaxSec=
The minimum and maximum poll intervals for NTP messages. Each setting takes a time
value (in seconds). PollIntervalMinSec= must not be smaller than 16 seconds.
PollIntervalMaxSec= must be larger than PollIntervalMinSec=. PollIntervalMinSec=
defaults to 32 seconds, and PollIntervalMaxSec= defaults to 2048 seconds.
The above appears to have been added in late 2017 - timesync: make poll interval configurable #7268.
References