hwclock commands with clock

There are two linux system clock:

  System clock: linux kernel by cpu timing by the operating frequency, the kernel will automatically read the hardware clock when the system starts, and then run independent from the system clock, after all of the instructions and the functions are linux reading system clock settings

  Hardware clock: motherboard clock timing device, it can be set by bios.

hwclock command set for displaying hardware and system clocks.

Command usage:

hwclock Displays the current system time

The main parameters

-w, --systohc the hardware clock is adjusted to be consistent with the current system clock.

-s, --hctosys the system clock is adjusted to be consistent with the current hardware clock.

Other parameters

When --adjust hwclock each time you change the hardware clock, it will be recorded in / etc / adjtime file. --Adjust use parameter can be estimated deviation hwclock hardware clock based on the previous recording, and for correcting the current hardware clock.

When hwclock --debug display detailed execution information.

--directisa hwclock preset from / dev / rtc device to access the hardware clock. If not accessible, this parameter can be used directly in the I / O instructions to access the hardware clock.

--set --date = <date and time> setting the hardware clock.

--show time and date display hardware clock.

--test only test program, but does not actually change the hardware clock.

--utc To use Greenwich Mean Time, add this parameter, hwclock will perform the work of conversion.

--version display version information.

 

Example 1:

[root@XX ~]# hwclock
Sun 10 Nov 2019 01:30:11 AM GMT  -0.324380 seconds

 

clock hwclock usage is consistent with usage.

[root@XX ~]# clock
Sun 10 Nov 2019 01:31:42 AM GMT  -0.458187 seconds
[root@XX ~]# clock -s
[root@XX ~]# clock
Sun 10 Nov 2019 01:31:55 AM GMT  -0.254939 seconds

 

Guess you like

Origin www.cnblogs.com/liuxuinUK/p/11828952.html