Setting Clock Using NTP

From Funtoo
Jump to navigation Jump to search

First off we are going to set up so that your computer will go out and find out what time it is on its own.

  1. emerge net-misc/ntp

The next two commands will update the time on your system and adjust the time for your hardware clock

  1. ntpdate time-a.nist.gov
  2. hwclock --systohc

Finally we are going to tell your computer that it needs to check the time when it boots up, and keep checking occasionally as long as it is booted up. Also we will set it up so that it will act as a time server for any other devices you might have on your network.

  1. rc-update add ntpd default
  2. rc-update add ntp-client default

In our last step we set our hardware clock, now we are going to define our hardware clock. In you favorite text editor, as root, you need to edit:

  1. nano /etc/conf.d/hwclock

You should see a line at the bottom of the top section that looks like

clock="UTC"

If it says anything other than UTC edit it and make it just as that line is in the example. Save and exit.

Now we are going to set a link to your actual timezone. The easiest way to drill down to this is using TAB complete, where you type a few letters and hit the tab key to complete the next little bit. If there are too many options it will show you your available options and then you keep typing. A pretty nifty trick.

  1. ln -s /usr/share/zoneinfo/USE_TAB_COMPLETE_HERE_TO_SELECT /etc/localtime

an example would be

ln -s /usr/share/zoneinfo/America/Adak /etc/localtime

All done and thanks for playing ~Az

Now I having been using this little guide for a long time, I love the tab complete to get to the timezones and just very simple for me. This was written by Azeroth in another wiki and is copied pasted here in it entirety, I do not claim writing any of it.