Heal Your Church WebSite


Teaching, rebuking, correcting & training in righteous web design.

How to set your system clock in Linux

So once again, that infernal Daylight saving time thingie bothers us by automatically setting, or perhaps not setting our system clocks on your Ubuntu, Red Hat, Fedora, Debian, Knoppix, or Suse install either an hour ahead, or remaining an hour late!

the official U.S. timeHere are two simple command lines to synchronize your Linux system clock with the atomic clocks offered by the National Institute of Standards and Technology … hmmmm … atomic energy ….

… sorry, got distracted with all that power at my disposal. So if you have access to the root account of your server, or better yet – have access to the guy who has access to the root account, here’s all you need to know:

/usr/sbin/ntpdate -b -s time-a.nist.gov
/sbin/hwclock --systohc --utc

Now if you don’t live in the EasternTime Zone as I do, then you’re NOT going to want time-a.nist.gov as your time server. Instead, go to the NIST Internet Time Service page and pick the server that best matches your timezone and daylight savings situation.

While you’re at it, you can also modify the /etc/rc.d/rc.local file to include the above commands – or at least the first command so it is executed when the server reboots.

For more gory details on this topic, here is a great little page called Linux Tips – Linux, Clocks, and Time to get ya going in the right place … at the right time (sorry, couldn’t resist the corn-ball humor opportunity).

Oh and for those in the U.S. who need to set the clock on the VCR (I know some of you still have them … blinking) and/or microwave oven to the correct time, there’s always the human readable the official U.S. time web page, also offered by NIST.

Like your mileage, your timezone may vary … and I promise … no more ‘geek speak’ for the rest of the week.

Comments are closed.