Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go

Clock: Date and Time

20191130 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:

$ timedatectl status
                      Local time: Sat 2019-11-30 13:02:57 AEDT
                  Universal time: Sat 2019-11-30 02:02:57 UTC
                        RTC time: Sat 2019-11-30 02:02:57
                       Time zone: Australia/Sydney (AEDT, +1100)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

Alternatively, the date command talks to the system clock and the hwclock command talks to the hardware clock.

$ date
Sat 30 Nov 12:31:59 AEDT 2019

$ sudo hwclock
2019-11-30 12:32:23.545087+1100

$ sudo hwclock --debug
hwclock from util-linux 2.31.1
System Time: 1575077617.821713
Trying to open: /dev/rtc0
Using the rtc interface to the clock.
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
...got clock tick
Time read from Hardware Clock: 2019/11/30 01:33:38
Hw clock time : 2019/11/30 01:33:38 = 1575077618 seconds since 1969
Time since last adjustment is 1575077618 seconds
Calculated Hardware Clock drift is 0.000000 seconds
2019-11-30 12:33:37.795041+1100


Subsections
Copyright © 1995-2020 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware and the author of open source software including Rattle and wajig.
Also the author of Data Mining with Rattle and Essentials of Data Science.