Quick take: timedatectl status shows the current time, timezone, and NTP sync state. timedatectl set-timezone Region/City changes the timezone. timedatectl set-ntp true enables automatic time sync.

What Is timedatectl in Linux?

timedatectl is the systemd command for managing date, time, timezone, and NTP synchronization on Linux systems. It replaces the older date command for configuration tasks and provides a clean interface to systemd-timesyncd — the built-in NTP client.

Correct system time is critical for SSL certificates, log correlation, Kerberos authentication, cron jobs, and distributed systems. timedatectl is the first command to run when setting up a new server or diagnosing time-related failures.

View Time Status

timedatectl status

Sample output:

               Local time: Tue 2026-04-15 14:23:45 AST
           Universal time: Tue 2026-04-15 11:23:45 UTC
                 RTC time: Tue 2026-04-15 11:23:44
                Time zone: Asia/Riyadh (AST, +0300)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Key fields: System clock synchronized (is NTP working?), NTP service (active/inactive), Time zone (current zone and offset).

Set Timezone

# List all available timezones
timedatectl list-timezones

# Filter by region
timedatectl list-timezones | grep Asia
timedatectl list-timezones | grep Europe

# Set timezone
timedatectl set-timezone Asia/Riyadh
timedatectl set-timezone Europe/London
timedatectl set-timezone America/New_York
timedatectl set-timezone UTC

# Verify the change
timedatectl status

The change takes effect immediately — running processes pick up the new timezone for log timestamps on the next restart, but the system clock itself is updated instantly.

Enable NTP Sync

# Enable NTP synchronization
timedatectl set-ntp true

# Disable NTP (required before setting time manually)
timedatectl set-ntp false

# Check NTP status
timedatectl show --property=NTPSynchronized
timedatectl show --property=NTPService

When NTP is enabled, systemd-timesyncd contacts time servers and adjusts the clock continuously. On a fresh server, initial sync may take 30–60 seconds.

Set Time Manually

# Must disable NTP first — NTP will override manual settings
timedatectl set-ntp false

# Set date and time
timedatectl set-time '2026-04-15 14:30:00'

# Set only the date
timedatectl set-time '2026-04-15'

# Re-enable NTP after manual adjustment
timedatectl set-ntp true

systemd-timesyncd Configuration

systemd-timesyncd is the NTP client that timedatectl controls. Its configuration lives at /etc/systemd/timesyncd.conf.

# View current NTP servers
cat /etc/systemd/timesyncd.conf

# Edit to set custom NTP servers
sudo nano /etc/systemd/timesyncd.conf

Default content:

[Time]
NTP=0.ubuntu.pool.ntp.org 1.ubuntu.pool.ntp.org
FallbackNTP=ntp.ubuntu.com
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048

After editing, restart the service:

sudo systemctl restart systemd-timesyncd
timedatectl status

Troubleshooting Time Issues

# Check timesyncd service status and recent logs
systemctl status systemd-timesyncd

# Watch sync journal
journalctl -u systemd-timesyncd -f

# If NTP is not syncing — check firewall (UDP 123 must be open)
sudo ufw status
# or
sudo firewall-cmd --list-all

# Force resync by restarting the service
sudo systemctl restart systemd-timesyncd

# Check hardware clock vs system clock
hwclock --show
timedatectl | grep "RTC time"

chrony vs systemd-timesyncd — Which NTP Client to Use?

Ubuntu uses systemd-timesyncd by default — a simple SNTP client that is sufficient for most servers. For environments that need tighter accuracy (financial systems, distributed databases, log correlation across datacenters), chrony is the recommended replacement.

Featuresystemd-timesyncdchrony
ProtocolSNTP (simplified NTP)Full NTP (RFC 5905)
Accuracy~1–50ms<1ms possible
Hardware clock syncYesYes
NTP server poolSingle serverMultiple, weighted
Leap second handlingBasicFull (smear or step)
Best forStandard servers, VMsDatabases, trading, infra requiring sub-ms sync
# Install chrony (replaces timesyncd)
sudo apt install chrony
sudo systemctl enable --now chrony
sudo systemctl disable systemd-timesyncd

# Check chrony sync status
chronyc tracking
chronyc sources -v

Hardware Clock vs System Clock

Linux maintains two clocks: the hardware clock (RTC — Real Time Clock) stored in BIOS/UEFI battery-backed memory, and the system clock maintained by the kernel in RAM. They can drift apart.

# Read the hardware clock directly
sudo hwclock --show

# Sync hardware clock from system clock
sudo hwclock --systohc

# Sync system clock from hardware clock  
sudo hwclock --hctosys

# Check if RTC is set to local time or UTC
timedatectl show --property=LocalRTC

Best practice: keep the hardware clock in UTC (RTC in local TZ: no) and let the OS handle timezone conversion. Mixing local time in the hardware clock with DST causes double timezone offsets on Windows/Linux dual-boot systems.

Using timedatectl in Shell Scripts

#!/bin/bash
# Verify NTP is synced before running a time-sensitive job

NTP_STATUS=$(timedatectl show --property=NTPSynchronized --value)
if [ "$NTP_STATUS" != "yes" ]; then
    echo "ERROR: NTP not synchronized. Aborting." >&2
    exit 1
fi

OFFSET=$(chronyc tracking 2>/dev/null | grep "System time" | awk '{print $4}')
echo "Clock OK — NTP synchronized. Offset: ${OFFSET}s"

Common timedatectl Errors and Fixes

ErrorCauseFix
Failed to set timezoneInvalid timezone nameRun timedatectl list-timezones | grep Region to find exact name
NTP service: inactivetimesyncd disabled or blockedsystemctl start systemd-timesyncd
System clock synchronized: noFirewall blocking UDP 123ufw allow out 123/udp
Cannot set time — NTP activeNTP overrides manual settingRun timedatectl set-ntp false first, set time, then re-enable
Clock drifts after rebootHardware clock in local timeSet timedatectl set-local-rtc 0 to force UTC in RTC

Reference: timedatectl official documentation — freedesktop.org. Tested on Ubuntu 22.04 LTS (kernel 5.15) and Ubuntu 24.04 LTS (kernel 6.8).

Final Thoughts

timedatectl is the authoritative tool for time management on systemd-based Linux systems. Run it immediately on any new server to verify the timezone and NTP are correctly configured. Incorrect time causes SSL errors, authentication failures, and corrupted log correlation — problems that are often misdiagnosed as application bugs.

FAQ: timedatectl Command in Linux

How do I set the timezone on a Linux server?+

Run timedatectl set-timezone Asia/Riyadh (replace with your timezone). Use timedatectl list-timezones | grep Region to find your timezone string. The change takes effect immediately.

How do I enable NTP time synchronization?+

Run timedatectl set-ntp true. This enables systemd-timesyncd, which syncs the clock automatically. Check sync status with timedatectl status and look for 'NTP service: active'.

How do I check if NTP is working on my server?+

Run timedatectl status and check the 'System clock synchronized' field. If it shows 'no', run systemctl status systemd-timesyncd to see why the sync is failing.

What is the difference between system clock and hardware clock?+

The system clock runs in kernel memory and is read by applications. The hardware clock (RTC) runs on the motherboard and persists through reboots. timedatectl syncs both.

How do I manually set the system time with timedatectl?+

First disable NTP: timedatectl set-ntp false. Then set the time: timedatectl set-time '2026-04-15 14:30:00'. Re-enable NTP afterward with timedatectl set-ntp true.

Need help with Linux servers or infrastructure?

Work directly with Muhammad Irfan Aslam for Linux, Ubuntu, Docker, DevOps, cloud, CI/CD, or infrastructure support.

Hire Me for Support