Configuring the Date and Time
Modern operating systems distinguish between the following two types of clocks:
A _real-time clock_ (*RTC*), commonly referred to as a _hardware clock_, (typically an integrated circuit on the system board) that is completely independent of the current state of the operating system and runs even when the computer is shut down.
A _system clock_, also known as a _software clock_, that is maintained by the kernel and its initial value is based on the real-time clock. Once the system is booted and the system clock is initialized, the system clock is completely independent of the real-time clock.
The system time is always kept in _Coordinated Universal Time_ (*UTC*) and converted in applications to local time as needed. _Local time_ is the actual time in your current time zone, taking into account _daylight saving time_ (*DST*). The real-time clock can use either UTC or local time. UTC is recommended.
{MAJOROSVER} offers three command line tools that can be used to configure and display information about the system date and time: the [command]#timedatectl# utility, which is new in {MAJOROSVER} and is part of `systemd`pass:attributes[{blank}]; the traditional [command]#date# command; and the [command]#hwclock# utility for accessing the hardware clock.
Using the timedatectl Command
The [application]*timedatectl* utility is distributed as part of the `systemd` system and service manager and allows you to review and change the configuration of the system clock. You can use this tool to change the current date and time, set the time zone, or enable automatic synchronization of the system clock with a remote server.
For information on how to display the current date and time in a custom format, see also xref:Configuring_the_Date_and_Time.adoc#sect-Configuring_the_Date_and_Time-date[Using the date Command].
Displaying the Current Date and Time
To display the current date and time along with detailed information about the configuration of the system and hardware clock, run the [command]#timedatectl# command with no additional command line options:
This displays the local and universal time, the currently used time zone, the status of the Network Time Protocol (`NTP`) configuration, and additional information related to DST.
The following is an example output of the [command]#timedatectl# command on a system that does not use `NTP` to synchronize the system clock with a remote server:
Local time: Mon 2013-09-16 19:30:24 CEST
Universal time: Mon 2013-09-16 17:30:24 UTC
Timezone: Europe/Prague (CEST, +0200)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2013-03-31 01:59:59 CET
Sun 2013-03-31 03:00:00 CEST
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2013-10-27 02:59:59 CEST
Sun 2013-10-27 02:00:00 CET
Changing the Current Time
To change the current time, type the following at a shell prompt as `root`:
[command]#timedatectl# [option]`set-time` _HH:MM:SS_
Replace _HH_ with an hour, _MM_ with a minute, and _SS_ with a second, all typed in two-digit form.
This command updates both the system time and the hardware clock. The result it is similar to using both the [command]#date --set# and [command]#hwclock --systohc# commands.