16 Clock: Date and Time
20210323 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:
## Local time: Fri 2021-09-24 09:14:23 AEST ## Universal time: Thu 2021-09-23 23:14:23 UTC ## RTC time: Thu 2021-09-23 23:14:23 ## Time zone: Australia/Sydney (AEST, +1000) ## System clock synchronized: yes ## NTP service: active ## RTC in local TZ: no
Alternatively, the date command talks to the system clock:
## Fri 24 Sep 2021 09:14:23 AEST
Meanwhile, the hwclock command talks to the hardware clock:
$ sudo hwclock 2021-03-23 07:42:20.426656+11:00
To set the system clock:
$ sudo date -s "13 Jun 2021 10:10:00"
To set the timezone:
$ sudo timedatectl set-timezone Australia/Canberra
Your donation will support ongoing availability and give you access to the PDF version of the 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-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.