Using the hwclock Command

Use the hwclock command to display or set your Linux system time, display or set your PC's hardware clock, or to synchronize the system and hardware times. To see your hardware date and time, use hwclock with its —show option like so:

$ sudo hwclock --show

Fri 27 Jan 2006 02:17:53 PM GMT -0.193809 seconds

Use hwclock with its --set and --date options to manually set the hardware clock like so:

$ sudo hwclock —set —date "01/27/06 08:00:00" $ sudo hwclock --show

Tue 27 Jan 2006 08:00:08 AM GMT -0.151718 seconds

In these examples, the hardware clock has been set using hwclock, which is then used again to verify the new hardware date and time. You can also hwclock to set the Linux system date and time date using your hardware clock's values with the Linux system date and time.

For example, to set the system time from your PC's hardware clock, use the --hctosys option like so:

$ sudo hwclock --hctosys

To set your hardware clock using the system time, use the --systohc option like so:

$ sudo hwclock --systohc

Was this article helpful?

0 0

Post a comment