Setting Your Linux System Clock
References:
Contents:
How To Do It
This is a quick and (not)dirty time setting procedure - if you want the long version see "Time for Linux" at Linux Planet.
If you are logged in as a user (which you should be), "su" to root and enter the following to set the current time:
# date -s "hh:mm:ss"
The time will be taken as 24-hour(military) time. Then type just the date command and see if it "took". Linux should respond with a full date and time.
Now, set the CMOS hardware clock to the system software current time:
# hwclock --systohc
A (Very) Little Background
"hwclock" is a command in /sbin. It accepts commands from the terminal, as you see above, and is called from a halt script in init.d when the system is shutdown, to copy the system time into the hardware clock.
Your system time zone and (if you live in the USA) "daylight savings" flag are used to restore the time on startup. Check that rhe zone is correct:
# date Sun Oct 28 08:45:47 PST 2001 ["PST" is the zone]
A list of zones available in your system can be found in /usr/share/zoneinfo/zone.tab . If your zone is not correct, you can append the correct zone to the time setting:
# date -s "hh:mm:sszzz" [where "zzz" is the zone]

plain