NTP and hwclock
Preface
Most of Servers and PC's that are today available have built in HW clock (but not all, Raspberry PI doesn’t have it). This type of time source is realized with HW that need permanent power connect (usually a battery). According to this theoretically it shall provide us reference time source. On another hand I need to say that most of this HW clock are not providing really accurate time. According to this it is possible to manually correct local HW time.
hwclock
This application is able directly (with help of BIOS) communicate with your HW Clock.
–show
Read and present the current configuration of you HW clock
[root@NTP-Stratum-2 ~]# hwclock --show Tue 18 Mar 2014 03:12:27 PM UTC -0.779488 seconds
–hctosys
Read HW time and confure OS time based on HW time
[root@NTP-Stratum-2 ~]# date 110212572003 # Change OS Time Sun Nov 2 12:57:00 UTC 2003 [root@NTP-Stratum-2 ~]# hwclock --show # Show HW time Tue 18 Mar 2014 03:16:59 PM UTC -0.518979 seconds [root@NTP-Stratum-2 ~]# hwclock --hctosys # Configure OS time based on HW time [root@NTP-Stratum-2 ~]# date # Check the OS time Tue Mar 18 15:17:14 UTC 2014
–systohc
Read OS time and configure HW time based on OS time.
[root@NTP-Stratum-2 ~]# date 110212572003 # Configure OS Time Sun Nov 2 12:57:00 UTC 2003 [root@NTP-Stratum-2 ~]# hwclock --show # Check HW time before change Tue 18 Mar 2014 03:22:34 PM UTC -0.134825 seconds [root@NTP-Stratum-2 ~]# hwclock --systohc # Update HW time with OS time [root@NTP-Stratum-2 ~]# hwclock --show # Check HW time after update Sun 02 Nov 2003 12:57:14 PM UTC -0.722921 seconds
–compare
Compare HW and OS time
[root@NTP-Stratum-2 ~]# hwclock --compare hw-time system-time freq-offset-ppm tick 1067778037 1067778037.083645 1067778047 1067778047.084476 83 1
–utc
Keep the HW time in UTC time zone
root@NTP-Stratum-2 ~]# hwclock --utc Tue 18 Mar 2014 03:29:47 PM UTC -0.134741 seconds
–debug
Get the status and configuration from HW clock
[root@NTP-Stratum-2 ~]# hwclock --debug hwclock from util-linux-ng 2.17.2 Using /dev interface to clock. Last drift adjustment done at 1395156423 seconds after 1969 Last calibration done at 1395156423 seconds after 1969 Hardware clock is on UTC time Assuming hardware clock is kept in UTC time. Waiting for clock tick... ...got clock tick Time read from Hardware Clock: 2014/03/18 15:31:35 Hw clock time : 2014/03/18 15:31:35 = 1395156695 seconds since 1969 Tue 18 Mar 2014 03:31:35 PM UTC -0.619014 seconds