17 Clock: Date and Time
20220704
There are two clocks in a computer: the system clock and the hardware clock. The system clock is maintained by the running operating system (e.g., GNU/Linux). It is also said to be maintained by the kernel. The hardware clock is part of the actual hardware of the computer and is usually battery backed up. The current status of the clock can be found from the timedatectl command from systemd:
The output might be something like:
Local time: Mon 2022-07-04 14:33:47 AEST
Universal time: Mon 2022-07-04 04:33:47 UTC
RTC time: Mon 2022-07-04 04:33:47
Time zone: Australia/Sydney (AEST, +1000)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
If the system clock is not being synchronised then that can be turned on with:
To set the timezone:
The date command will also show the current time from the system clock:
## Fri Dec 6 12:10:25 PM AEDT 2024
Meanwhile, the hwclock command talks to the hardware clock:
To set the system clock:
Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0