Troubleshooters.Com and T.C Linux Library Present

Setting Your System Time

Copyright (C) 2001 by Steve Litt
[ Linux Library | Troubleshooters.Com | Email Steve Litt | Copyright Notice ]

Warning!!!

This is not the best way to set your system time. It is not even the recommended way to set your system time. As a matter of fact, most documentation warns you AGAINST setting your system time with the date command, which is what this document discusses.

That being said, this is simple, and for small time adjustments, I personally use it.

Setting Your System Time

A little explanation is in order.


System time runs off interrupts and is extremely accurate. The only problem is that it doesn't work unless the operating system is working. For times when the computer is down, the hardware clock must keep time. Then, when the computer is booted, the hardware clock time is copied to the system time. Naturally, part of an orderly shutdown is to copy the system time to the hardware clock.

/sbin/hwclock -r
shows you the time according to the hardware clock. It will most likely be wrong.

/sbin/hwclock --adjust
makes changes the hardware clock adjustment mechanism so that the hardware clock more accurately follows system time.

/sbin/hwclock --systohc
sets the hardware clock to the system time.

Remember, date sets your system time, which is updated by interrupts while the operating system is running. hwclock sets your hardware clock, which is a digital watch type clock on your motherboard, which runs continuously on battery power whether the system is running or not.

Other Time Setting Documentation

See man hwclock, man date, and man adjtimex for details on Linux time. You'll notice that these man pages recommend against the method I outlined above. I use my method because it's simple and for no other reason.

There are also time howtos on the Internet.


See also: [ Linux Library | Troubleshooters.Com | Email Steve Litt | Copyright Notice ]

Copyright (C)2001 by Steve Litt. -- Legal