Wednesday, January 17, 2018

linux: display, reset, and synchronize hardware clock and kernel / system clock

The hardware clock is backed by the battery and runs all the time even the machine is turned off. The hardware clock is also know as the BIOS clock, RTC (Real Time Clock) or CMOS. The kernel clock, also known as the system clock or software clock, is maintained by the operating system. The system clock is set at boot time according to the hardware clock.

A. Display Date and Time

1. Display the hardware clock date and time

      You may need to login as root

      [root@MyServer ~]# hwclock
      Wed Jan 17 10:11:07 2018  -0.507816 seconds

2. Display the system clock date and tiem

      [root@MyServer ~]# date
      Wed Jan 17 10:56:24 EST 2018

B Sync Hardware Clock and System Clock

      The date and time has a difference between the hardware clock and the system clock.
      [root@MyServer ~]# hwclock
      Wed Jan 17 10:56:00 2018  -0.750876 seconds

      [root@MyServer~]# date
      Wed Jan 17 10:56:24 EST 2018

1. Copy system clock date and time to hardware clock

      [root@MyServer~]# hwclock -w
      or
      [root@MyServer~]# hwclock --systohc

2. Copy hardware clock date and time to system clock

      [root@MyServer~]# hwclock -s
      or
      [root@MyServer~]# hwclock -hctosys

C. Set The Harware Clock Date and Time Manually

      [root@MyServer~]# hwclock --set --date "1/17/2018 10:56:24"
      or
      [root@MyServer~]# hwclock --set --date "Wed Jan 17 10:56:24 EST 2018"

      If you don't specify the time, it will be set to 12:00:00AM
      [root@MyServer~]# hwclock --set --date 1/17/2018

D. Adjust the Hardware Clock

      This add or subtract time from the hardware clock to account for systematic drift since last time the clock was set or adjusted. 
     [root@MyServer~]# hwclock --adjust

--------------------------------------------------------------------------------------------------------------

                        

If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.

No comments:

Post a Comment