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: Sat 2021-06-12 09:33:14 AEST ## Universal time: Fri 2021-06-11 23:33:14 UTC ## RTC time: Fri 2021-06-11 23:33:14 ## 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:
## Sat 12 Jun 2021 09:33:14 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 development 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-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.