On a server you have no option but to get time right.
All servers on the Internet synchronize to Coordinated Universal Time – UTC – via NTP. UTC is a derivative of International Atomic Time
Time is expressed in many different ways. Typically a computers time is displayed in the local timezone.
See also:
Time formats
Current local time / UTC
The following formats current UTC time in seconds resolution
date -uIs
date -u --rfc-3339 s
date -uR
For local time just omit the u
tai64n
TAI64 is used in ?multilog and ?svlogd logfiles.
Read/follow a multilog logfile in local time:
<logfile tai64nlocal | less -S
tail -F logfile | tai64nlocal
tai64nlocal
comes with daemontools.
Notes:
- Use
TZ=
on the commandline to get timestamps in UTC. This does not work currently (01/2019) with diet libc compiled daemontools.
Synchronization
Pool
We use time servers from the NTP pool.
On portable computes the global servers are the best choice, on stationary equipment – like servers – use the respective zone, e.g.:
Client software
systemd.timesyncd
Newer Debian uses systemd
and comes with systemd-timesyncd
which
uses the global servers by default. Configure other pool
zones within /etc/systemd/timesyncd.conf
For Germany: [[!format Error: unsupported page format tcsh"""]]
After configuration restart timesyncd
:
service systemd-timesyncd restart
Check the status of timesyncd
:
systemctl status systemd-timesyncd
Check time synchronization in general:
timedatectl
Disable timesyncd:
systemctl stop systemd-timesyncd
systemctl disable systemd-timesyncd
No uninstallation is possible, since it is integrated into systemd
.
Chrony
chrony is the ntp client of choice on other systems.
Configure it in /etc/chrony/chrony.conf
.
Check the configuration
chronyc sources
. The starred server is the one selected for synchronization.
You can speed up synchronization with:
chronyc
chronyc> passwd <password from /etc/chrony/chrony.keys>
chronyc> burst 10/10
Check synchronization status:
chronyc tracking
.
Newer chrony
s allow to specify a pool as well as the iburst
directive to get faster on track:
pool 0.de.pool.ntp.org iburst
pool 1.de.pool.ntp.org iburst
pool 2.de.pool.ntp.org iburst
pool 3.de.pool.ntp.org iburst
Virtual Servers
Some virtualizations force the hwclock to the host time. If that is synchronized the guest does not need network synchronization
Hetzner vCloud
Based on KVM, seems to be in good sync. Nontheless, the Debian image
installs systemd-timesyncd
, although it is not configured to the
Hetzner NTP servers.