timezone
タイムゾーンの設定をします。設定は/etc/localtimeをシンボリックリンクで作成します。リンク先は/usr/share/zoneinfoフォルダ内の(タイムゾーン)ファイルを指定します。インストール時にJapanを選択していれば、/etc/localtimeは/usr/share/zoneinfo/Japanのシンボリックリンクになっています。
> ls -l /etc/localtime
lrwxr-xr-x 1 root wheel 25 Feb 11 09:03 localtime@ -> /usr/share/zoneinfo/Japan
rtclocaltime
BIOSの時刻を現地時間として使用するように設定します。Windowsとデュアルブート環境では必ず必要です。/etc/rc.confを編集します。
直ぐに反映させるには /etc/rc.d/rtclocaltime start を実行します。
rtclocaltime=YES
ただし、この方法だとrcスクリプトを読んでから調整するので、/var/log/messegesを見ると起動中の時刻は現地時刻になりません。
そこで以下の方法ならば、この問題も解決します。
kern.rtc_offset
gdbを使用してカーネルにパッチをあてます。rtc_offsetに-540(分)をセットします。
> gdb --write /netbsd
GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386--netbsdelf"...
(gdb) set rtc_offset=-540
(gdb) quit
パッチをあてたらパッチをあてたカーネルを読み込ませるためPCを再起動しsysctl kern.rtc_offset でkern.rtc_offsetの値を確認します。
カーネルをコンパイルする機会があれば、カーネルで設定した方が良いです。
> sysctl kern.rtc_offset
kern.rtc_offset = -540
ntpdate
時刻の設定が済んだらntpサーバーから時刻を取得します。
> ntpdate ntp.nict.jp
起動時にntpdateで時刻を設定する場合/etc/rc.confを編集します。ずっと起動させたまま使用するサーバーなどではcronに設定し定時に更新した方が良いです。
ntpdate=YES
ntpdate_hosts="ntp.nict.jp"