Configure Local Timezone
Make sure your /etc/localtime file is linked to the correct time zone file
for your region. For example, if you were in the US Central time zone,
your /etc/localtime file should be linked as follows (from afterboot(8)):
ln -fs /usr/share/zoneinfo/US/Central /etc/localtime
This will designate Atlantic Standard Time as your system's time zone.
Getting time from the Internet
Set up NTP so that your machine will always have accurate time. Pick two
servers from the public NTP server list and make sure /etc/ntp.conf looks
like this:
#/etc/ntp.conf
server ntp.server.first
server ntp.server.second
Since xntpd is not part of the standard install, you have to compile xntpd
from source.
bash-2.04# cd /usr/ports/sysutils/xntpd
bash-2.04# make all install
You can also install it from a package:
pkg_add /cdrom/i386/ntp-4.1.71.tgz
The tools will be installed into /usr/local/sbin/ntpd.
To update local time:
ntpdate -b server
Where server is one of the servers in your ntp.conf file. If you would like
the OpenBSD machine's system time to be synchronized on boot, modify the
ntpdate_flags variable in /etc/rc.conf to equal one of the servers specified
in your ntp.conf file
This will perform a coarse adjustment of the system clock. The next time the
machine reboots, it will sync your clock and record how much your clock
drifts.
Run NTPD. By default, it is installed in /usr/local/sbin/ntpd.
To monitor the status of the NTP daemon, use the utility
/usr/local/sbin/ntpq. This is an interactive client to the NTP daemon
running on your machine. The two commands I find most helpful in debugging
the NTP daemon are "pe" and "rv", which allow you to see a peer list and
read the current NTP variables, respectively. See the NTPD documentation
for more details.
If you would like NTPD to run automatically the next time your system is
restarted, modify the ntpd variable in /etc/rc.conf to equal "YES".
If you use the configuration above, all requests from hosts other than those
specified will be ignored. To enable all hosts on the network 10.0.0.0/24 to
query your server for NTP information, add the following line to ntp.conf:
restrict 192.168.1.0 mask 255.255.255.0 nomodify nopeer
Use your network address and mask if applicable.