Linux (Redhat / Fedora / CentOS) 設定時間的方式
- copy /usr/share/zoneinfo/* 內的確切時區資料檔案為 /etc/localtime
- 執行 date -u
- 輸入 date 看看是否已經是正確時區
- 調整系統時間
- 透過 ntpdate -u time.stdtime.gov.tw 來校正目前時間
- 透過 date –set=“2003-02-19 17:44” 方式直接手動設定
- 輸入 hwclock 看看目前 BIOS 的時間是否正確
- 執行 clock –systohc 將目前系統時間寫入 BIOS 時間
- 輸入 date 與 hwclock 看看時間是否一致..
以下是執行範例
[[email protected] ~]# cp /usr/share/zoneinfo/Asia/Taipei /etc/localtime [[email protected] ~]# md5sum /usr/share/zoneinfo/Asia/Taipei 2cb7700780c8b4963f72c9dab967cffa /usr/share/zoneinfo/Asia/Taipei [[email protected] ~]# md5sum /etc/localtime 2cb7700780c8b4963f72c9dab967cffa /etc/localtime [[email protected] ~]# date -u Thu Jun 26 01:46:53 UTC 2008 [[email protected] ~]# date Thu Jun 26 09:47:09 CST 2008 [[email protected] ~]# ntpdate -u time.stdtime.gov.tw 26 Jun 09:48:58 ntpdate[4517]: adjust time server 220.130.158.52 offset -0.000482 sec [[email protected] ~]# hwclock Sat Apr 26 09:49:22 2008 -0.812668 seconds [[email protected] ~]# clock --systohc [[email protected] ~]# date Thu Jun 26 09:49:48 CST 2008 [[email protected] ~]# hwclock Thu Jun 26 09:49:51 2008 -0.179890 seconds