Time Keeping in Linux

Setting System Time
To set the system clock under Linux, use the date command. As an example, to set the current time and date to July 31, 11:16pm, type “date 07312316” (note that the time is given in 24 hour notation). If you wanted to change the year as well, you could type “date 073123161998”. To set the seconds as well, type “date 07312316.30” or “date 073123161998.30”. To see what Linux thinks the current local time is, run date with no arguments.

Setting Hardware Time (HWCLOCK)
To set the hardware clock, my favourite way is to set the system clock first, and then set the hardware clock to the current system clock by typing “/sbin/hwclock --systohc” (or “/sbin/hwclock --systohc --utc” if you are keeping the hardware clock in UTC). To see what the hardware clock is currently set to, run hwclock with no arguments.

Was this post helpful?

Total Page Visits: 697 - Today Page Visits: 1