how to use hwclock command and its examples

  • About hwclock : To query and set the hardware clock (RTC)
  • It comes from “util-linux-ng-2.17.2” package.

Examples:

1. To see the hardware clock

$ hwclock

2. To read the Hardware Clock and print the time on Standard Output

$ hwclock -r
$ hwclock –show 

3. To set the Hardware Clock to the time given by the –date option

$ hwclock –date=””

4. To set the system time from the hardware clock

$ hwclock -s
$ hwclock –hctosys 

5. To set the hardware clock to current system time

$ hwclock -w

$ hwclock –systohc 

6. To reset the system time based on current timezone

$ hwclock –systz

7. To Add  or  subtract time from the Hardware Clock to account for systematic drift

$ hwclock –adjust

8. To Print the kernelâs Hardware Clock epoch value to standard output

$ hwclock –getepoch

9. To Set the kernel’s Hardware Clock epoch value to the value specified

$ hwclock –setepoch–epoch=1970

10. To get the version of hwclock

$ hwclock -v
$ hwclock –version 

11. To keep hardware clock in localtime

$ hwclock –localtime 

12. To disable the facilities provided by “/etc/adjtime.”

$ hwclock –noadjfile

13. To overrides the default /etc/adjtime

$ hwclock –adjfile=filename

14. To overrides  the  default  /dev file name, which is /dev/rtc

$ hwclock -f
$ hwclock –rtc=filename 

15. To set hardware clock year storing range

$ hwclock –badyear

16. To specify the most common epoch

$ hwclock –srm

17. To to specify the most common epoch

$ hwclock –arc

18. To test the hardware clock

$ hwclock –test

19. To debug the hardware clock

$ hwclock –debug

Leave a Reply

Your email address will not be published. Required fields are marked *