FlossDoc: 请协力 GPLv3 的中文翻译工作。

設定時區

FlossDoc,自由中文開源知識庫

Jump to: navigation, search

標準文章
作者: Roy Chan
協力: -
校對: -
級別: 初階
分享本文:

目录

設定時區

GNOME

右擊頂部面板右上角的日期時間,選『調節日期及時間』(Adjust Time & Date):

輸入密碼:

按『選取時間...』(Select Time Zone):

在地圖上點擊您所在地的時區:

您亦可以在下面『時區』(Time zone)中直接選擇您所在地的時區。

tzconfig

以系統管理員 root 身份輸入命令 tzconfig

# tzconfig
Your current time zone is set to Asia/Hong_Kong
Do you want to change that? [n]: y

Please enter the number of the geographic area in which you live:


        1) Africa                       7) Australia

        2) America                      8) Europe

        3) US time zones                9) Indian Ocean

        4) Canada time zones            10) Pacific Ocean

        5) Asia                         11) Use System V style time zones

        6) Atlantic Ocean               12) None of the above


Then you will be shown a list of cities which represent the time zone
in which they are located. You should choose a city in your time zone.

Number: 5

Aden Almaty Amman Anadyr Aqtau Aqtobe Ashgabat Ashkhabad Baghdad Bahrain
Baku Bangkok Beirut Bishkek Brunei Calcutta Choibalsan Chongqing Chungking
Colombo Dacca Damascus Dhaka Dili Dubai Dushanbe Gaza Harbin Hong_Kong
Hovd Irkutsk Istanbul Jakarta Jayapura Jerusalem Kabul Kamchatka Karachi
Kashgar Katmandu Krasnoyarsk Kuala_Lumpur Kuching Kuwait Macao Macau
Magadan Makassar Manila Muscat Nicosia Novosibirsk Omsk Oral Phnom_Penh
Pontianak Pyongyang Qatar Qyzylorda Rangoon Riyadh Riyadh87 Riyadh88
Riyadh89 Saigon Sakhalin Samarkand Seoul Shanghai Singapore Taipei
Tashkent Tbilisi Tehran Tel_Aviv Thimbu Thimphu Tokyo Ujung_Pandang
Ulaanbaatar Ulan_Bator Urumqi Vientiane Vladivostok Yakutsk Yekaterinburg
Yerevan
 
Please enter the name of one of these cities or zones
You just need to type enough letters to resolve ambiguities
Press Enter to view all of them again
Name: [] Hong
Your default time zone is set to 'Asia/Hong_Kong'.
Local time is now:      五 11月 10 02:48:15 HKT 2006.
Universal Time is now:  四 11月  9 18:48:15 UTC 2006.
#

手動設定

各地的時區資料一般都會被放在目錄 /usr/share/zoneinfo 或 /usr/lib/zoneinfo 中。您只需要建立一個由/etc/localtime 指向 /usr/share/zoneinfo/ 中對應時區檔案的軟連結 (symbolic link) 就可以了。

ln -sf /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime

設定 BIOS 時間使用 UTC 時區

傳統 Unix 系統都建議硬件時鐘使用 UTC 時區 (即格林威治 GMT)。這可以避免錯誤計算日光節約時間的情況。而如果相關電腦系統是在各不同時區穿梭的筆記簿型電腦,切換系統時區時亦較為方便和準確。[1]

然而,Windows Vista 或以前的系統一直只假定硬件時鐘的時區假定為您所屬時區。當同一台電腦有硬件時鐘使用 UTC 時區的 GNU/Linux 和硬件時鐘為所在時區的 Windows 系統,兩個作業系統交替啟動時,將做成時區混亂。所以一般雙啟動 (dual boot) 中的 GNU/Linux 都會和 Windows 設定硬件時鐘為所在時區。

Debian 或 Ubuntu

在檔案 /etc/default/rcS 中,將選項 UTC 的值設定成 yes ,例如:

#
# /etc/default/rcS
#
# Default settings for the scripts in /etc/rcS.d/
#
# For information about these variables see the rcS(5) manual page.
#
# This file belongs to the "initscripts" package.

TMPTIME=0
SULOGIN=no
DELAYLOGIN=no
UTC=yes
VERBOSE=no
FSCKFIX=no

如果不想 BIOS 時間依 UTC 時區,可以將選項 UTC 設定為 no。

CentOS/Fedora/RHEL

在檔案 /etc/sysconfig/clock 中,將選項 UTC 的值設定成 true 或 yes,例如:

Zone="Asia/Hong_Kong"
UTC=true
ARC=false

如果不想 BIOS 時間依 UTC 時區,可以將選項 UTC 設定為 false 或 no。

參考資料

  1. Markus Kuhn (2001-07-02). IBM PC Real Time Clock should run in UT

請參看

外部連結

Personal tools