Pcornel
Linux

Time & NTP

Cheat sheet · https://pcornel.dk/topic.php?topic=2829

Back to the Topic

Answer

Time on Linux has two parts: the system clock (kept by the kernel, synchronised by NTP via chrony or systemd-timesyncd) and the hardware RTC. Time zones only change how time is displayed.

Remember

Keep every server on NTP and the RTC in UTC. A few seconds of offset breaks Kerberos (5-minute limit) and confuses log correlation; a large offset breaks TLS certificates.

First checks

  • timedatectl — time, time zone and sync status
  • chronyc tracking — offset and source (chrony)
  • chronyc sources -v — time sources and reachability
  • date -u — UTC time

Commands

timedatectl
Inspect or change system time, timezone, RTC and systemd-timesyncd-related settings.
chronyc
Inspect or control a chronyd time-synchronization daemon through its command interface.

Verify in this order

NTP sources reachable → chrony selects a source → system clock disciplined → RTC updated → time zone applied for display

Where it usually breaks

First mismatch in persistent intent → provider/parser/generator → kernel/userspace runtime → dependency/security context → logs/counters → consumer-visible read-back; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2829

Confirmation

Confirm action

Continue?