$ run as a normal user# run as root (or with sudo)
Exam objectives in this chapter
- Set up time service clients
Understand local time
A computer has two clocks. The hardware clock (RTC) runs on the mainboard battery also when the machine is off. The system clock is kept by the kernel while Linux runs; it starts from the hardware clock at boot.
| Clock | Where | Tool |
|---|---|---|
| Hardware clock (RTC) | Mainboard, battery | hwclock |
| System clock | Kernel | date, timedatectl |
- Linux keeps the system clock in UTC and shows it in your time zone.
- The hardware clock should also be UTC (
RTC in local TZ: no).
Use network time
NTP (Network Time Protocol) syncs the clock with time servers. RHEL uses chrony (chronyd) as NTP client and server. Servers are ordered in strata: stratum 1 has a real reference clock (GPS, atomic); stratum 2 syncs from stratum 1, and so on.
Show and set the time with date
date shows the system time in any format, and root can set it (better: let NTP do it).
Use hwclock
hwclock reads and sets the hardware clock, and copies time between the two clocks.
Use timedatectl
timedatectl shows all time settings at once and changes time, time zone and NTP use.
timedatectl
Local time: Sun 2026-10-25 11:42:10 CET
Universal time: Sun 2026-10-25 10:42:10 UTC
RTC time: Sun 2026-10-25 10:42:10
Time zone: Europe/Amsterdam (CET, +0100)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
timedatectl set-ntp true
timedatectl set-ntp false
timedatectl set-time "2026-10-25 12:00:00"Watch out
set-time only works when NTP is off. With NTP on, chrony corrects the clock anyway.
Manage the time zone
The time zone is the link /etc/localtime → a file in /usr/share/zoneinfo/. Change it with timedatectl set-timezone.
timedatectl list-timezones | grep -i riyadh
Asia/Riyadh
timedatectl set-timezone Asia/Riyadh
ls -l /etc/localtime
TZ=America/New_York date
tzselectNote
tzselect only helps you find the name (with questions); it does not change the system.
Configure time service clients
Tell chrony which time servers to use in /etc/chrony.conf, restart it, and check the sources.
- Set the server (replace the pool line or add a server line)./etc/chrony.conf (part)
# pool 2.rhel.pool.ntp.org iburst server 192.168.122.1 iburst driftfile /var/lib/chrony/drift makestep 1.0 3 rtcsync - Restart chrony and open the firewall only if this host is a time server for others.
- Make the clock step at once if it is far off.
chronyc makestep
| chronyc output | Meaning |
|---|---|
^* | The source chrony uses now |
^+ | A good source that is combined |
^? / ^x | Not reachable / falseticker (wrong time) |
Leap status: Normal (tracking) | Synchronized |
Exam tip
"Configure the system as an NTP client of classroom.example.com" = a server classroom.example.com iburst line in /etc/chrony.conf, systemctl restart chronyd, then check chronyc sources shows ^*.
At work
To make a server an NTP server for your network, add allow 192.168.122.0/24 to chrony.conf and open the firewall service ntp.
Remember the main points
The most important facts of this chapter, in short.
- A system has two clocks: the hardware clock (RTC, on the mainboard) and the system clock (kernel).
- Linux keeps the system clock in UTC and shows it in the local time zone.
timedatectlshows everything;timedatectl set-timezone Area/Citychanges the zone;timedatectl set-ntp trueturns on time sync.dateshows and formats the time;hwclockreads and sets the hardware clock.- RHEL syncs time with chrony (
chronyd); servers are set in/etc/chrony.confwithserver NAME iburstorpool NAME iburst. - After a change:
systemctl restart chronyd, then check withchronyc sources -v(^*= the source in use) andchronyc tracking.
Learn the key terms
The words of this chapter in simple English.
| Term | Meaning |
|---|---|
| Hardware clock (RTC) | The clock on the mainboard that runs when the computer is off. |
| System clock | The clock of the running kernel. |
| UTC | Coordinated Universal Time: the base time without time zones. |
| Time zone | The local time rule of a place, like Asia/Riyadh. |
| NTP | Network Time Protocol: sync the clock over the network. |
| chronyd | The NTP service of RHEL. |
| Stratum | How far a time server is from a real reference clock. |
| iburst | Send the first requests fast to sync quickly. |
Check what you learned
Think about the answer first, then open it.
1How do you set the time zone to Europe/Amsterdam?
2How do you find the exact name of a time zone?
3Make this system an NTP client of classroom.example.com.
Add server classroom.example.com iburst to /etc/chrony.conf, systemctl restart chronyd, check chronyc sources.
4In chronyc sources, what does ^* mean?
That is the source chrony uses now.
5How do you turn on time sync with timedatectl?
6Why can timedatectl set-time fail?
It does not work while NTP sync is on.