In a Linux system, we can view the time of the system or the time of the underlying hardware.

Hardware Time

We can view the time of the hardware by using the hwclock or clock command. We looked at the two commands separately through the ll command, and we learned that clock was a soft link to hwclock, so they were the same.

With the help of the man command, we know that hwclock is the command used by system administrators:

img

man hwclock result

Let’s try the results of the two commands separately

1
hwclock
img

hwclock executing result

1
clock
img

clock executing result

System Time

We can use the date command to get the system time.

With the help of the man command, we know that date is the command used by users:

img

man date result

Let’s also try the date command:

1
date
img

date executing result

Synchronization Between Them

We can synchronise the time between the system and the hardware with some parameters of the hwclock command.

Synchronizing system time to hardware time

We can append the -w parameter to the clock or hwclock command to synchronise system time to hardware time:

1
hwclock -w

Synchronizing hardware time to system time

We can append the -s parameter to the clock or hwclock command to synchronise hardware time to system time:

1
hwclock -s

Differences Between Them

Hardware time is generally used when the system starts. System time is generally used after the system is started.

References HWCLOCK, DATE

Buy me a coffeeBuy me a coffee