Keeping system time correct

Keeping the clock right: setting it by hand, synchronising it with NTP or chrony, and the systemd command that has quietly replaced most of the older ones.

Lesson 1 of 4 in objective 108. Essential system services, part of LPIC-1 Exam 102-500.

Strata: how many hops you are from a real clock. From the reference itself to your machine: Stratum 0 (a GPS receiver or an atomic clock), then Stratum 1 (a server wired directly to one), then Stratum 2 (synchronises from stratum 1), then Your client (ntpd or chrony, steering slowly). the reference itself Stratum 0 a GPS receiver or an atomic clock Stratum 1 a server wired directly to one Stratum 2 synchronises from stratum 1 Your client ntpd or chrony, steering slowly your machine
Strata: how many hops you are from a real clock.

Setting it by hand, and why that is not enough

date prints the system time and, given a +FORMAT string, prints it however you like; date -s sets it. hwclock talks to the firmware clock, the battery-backed one on the board that keeps time while the machine is off: hwclock --systohc (or -w) copies system time into it and hwclock --hctosys (or -s) copies it back, which are the two directions worth remembering by name. Setting a clock by hand is always a correction, never a solution — quartz drifts, and a machine left alone will be seconds out within weeks and minutes out within a year.

hwclock writes to hardware, so it is an administrative tool and lives with the others: /sbin/hwclock, or /usr/sbin/hwclock on a merged system. A question that gives the full path is asking whether you know that an ordinary user cannot set the hardware clock. /etc/adjtime is where it records the drift it has measured, and whether the hardware clock is being kept in UTC or in local time.

The time ZONE is separate from the clock. /etc/localtime is the file the C library reads to convert the stored UTC into local time, and it is a copy of — or, on most distributions, a symlink to — one of the zone files under /usr/share/zoneinfo, so /etc/localtime pointing at /usr/share/zoneinfo/Europe/Berlin IS how the machine knows it is in Berlin. Debian family systems also keep the name in /etc/timezone. timedatectl set-timezone Europe/Berlin does the whole thing on a systemd machine, and timedatectl list-timezones prints the names it will accept.

Where the zone enters: it renames the instant rather than changing it. In order: Hardware clock (battery-backed on the board; keeps time while the machine is off), then System clock, in UTC (hwclock --hctosys copies the hardware clock into it), then The C library converts (it reads /etc/localtime, copied or linked from /usr/share/zoneinfo), then Local time on screen (the same instant, named for where you are). Hardware clock battery-backed on the board; keeps time while the machine is off System clock, in UTC hwclock --hctosys copies the hardware clock into it The C library converts it reads /etc/localtime, copied or linked from /usr/share/zoneinfo Local time on screen the same instant, named for where you are
Where the zone enters: it renames the instant rather than changing it.
timedatectl     Local time: Mon 2026-08-03 19:24:11 CEST  RTC time: Mon 2026-08-03 17:24:09 Time zone: Europe/Berlin (CEST, +0200)System clock synchronized: yesls -l /etc/localtime... /etc/localtime -> /usr/share/zoneinfo/Europe/Berlin/sbin/hwclock --systohcsystem time written into the battery-backed clock
Both clocks, both directions, and where the zone comes from.

Synchronising

NTP arranges servers in strata: stratum 0 is a reference clock such as GPS or an atomic clock, stratum 1 is a server directly attached to one, and each level below is one hop further away. A client picks servers, measures round-trip delay, and steers its clock gradually rather than jumping — because a clock that jumps backwards breaks anything that assumes time only moves forward.

The classic daemon is ntpd, configured in /etc/ntp.conf with server or pool lines, and queried with ntpq -p, which prints the peers and which one is currently selected. chrony is the modern replacement, configured in /etc/chrony.conf and queried with chronyc sources; it copes far better with intermittent connections and virtual machines. ntpdate set the clock once at boot and is deprecated in favour of the daemons doing it properly.

Both configurations offer the same pair of directives, and the difference between them is asked directly. server binds ONE source. pool names something expected to resolve to several addresses and binds several of them as independent sources, which is what the public pool.ntp.org names are for — the numbered prefixes 0. through 3. exist so a host can list several pool lines and be handed different sets of servers. Per-source options are written after either directive: iburst sends a short rapid burst on the first exchange so a freshly booted machine synchronises in seconds rather than minutes, and maxsources caps how many sources are taken from a pool, so pool 2.pool.ntp.org iburst maxsources 4 yields at most four.

On a systemd machine, systemd-timesyncd is a lightweight SNTP client that does the common case, and timedatectl set-ntp true turns it on. timedatectl is also where you read whether the clock is synchronised at all.

Which name belongs to which time daemon, and the one name that belongs to none. Left column, The name the question hands you; right column, The daemon it belongs to. /etc/ntp.conf and ntpq -p both point at ntpd (The classic daemon: server and pool lines, and which peer is selected). /etc/chrony.conf and chronyc sources both point at chrony (The modern replacement, better on intermittent connections and virtual machines). timedatectl set-ntp true points at systemd-timesyncd (A lightweight SNTP client for the common case). ntpdate points at No daemon at all (It set the clock once at boot and is deprecated in favour of the daemons). The name the question hands you The daemon it belongs to /etc/ntp.conf ntpq -p ntpd The classic daemon: server and pool lines, and which peer is selected /etc/chrony.conf chronyc sources chrony The modern replacement, better on intermittent connections and virtual machines timedatectl set-ntp true systemd-timesyncd A lightweight SNTP client for the common case ntpdate No daemon at all It set the clock once at boot and is deprecated in favour of the daemons
Which name belongs to which time daemon, and the one name that belongs to none.

Worth carrying in

date -s "…"
Set the system clock. date +FORMAT prints it your way.
/sbin/hwclock --systohc
System clock to hardware clock. -w is the same; --hctosys and -s are the other direction.
/etc/localtime
The zone file the C library reads. A copy of, or a symlink to, one under /usr/share/zoneinfo.
timedatectl set-timezone
Set the zone by name. list-timezones prints the names it accepts.
/etc/ntp.conf
ntpd configuration: server and pool lines.
ntpq -p
Peers and which is selected.
chronyc sources
The chrony equivalent; /etc/chrony.conf is its configuration.
pool … iburst maxsources 4
One name, several sources, capped at four. server binds exactly one.
timedatectl set-ntp true
Turn on systemd-timesyncd synchronisation.
stratum
Distance from a reference clock. Stratum 0 is the reference itself.

What the exam does with this

Objective
108. Essential system services
Share of the exam
18.33% (the whole objective)
Questions in this lesson
15
Signed for by a person
0

Partly checked. None of the 15 questions here has been read against the cited source by a person. 15 questions have been checked against their cited clause by an automated pass — which is not the same thing, and is not a signature.

Only questions a person has signed for are used in mock exams here. That is the whole difference between the two kinds of checking above.

How these questions are written — where each question comes from, what the verification ledger records, and what happens when one is found wrong.

Drill this lesson

A lesson is one sitting: the trainer draws a short run from these questions alone and spaces the ones you get wrong.

Practise Keeping system time correct

Questions in this lesson

Practise Keeping system time correct

The rest of objective 108