久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

ubuntu系統怎么修改時區和時間

167次閱讀
沒有評論

共計 3030 個字符,預計需要花費 8 分鐘才能閱讀完成。

本文丸趣 TV 小編為大家詳細介紹“ubuntu 系統怎么修改時區和時間”,內容詳細,步驟清晰,細節處理妥當,希望這篇“ubuntu 系統怎么修改時區和時間”文章能幫助大家解決疑惑,下面跟著丸趣 TV 小編的思路慢慢深入,一起來學習新知識吧。

在 linux 計算機上,有兩個時間,一個是硬件時間(bios 中記錄的時間,稱為 hwclock),另一個是操作系統時間(osclock)。硬件時鐘由 bios 電池供電,

當計算機關機后,會繼續運行,bios 電池一般可使用幾年,如果沒電了,那 bios 中的數據會恢復出廠設置。

硬件時間與操作系統時間的交互流程

1、開機時,操作系統從 bios 中讀取硬件時間 + 時區,然后根據 osclock 的時區,轉換為對應的時間。然后操作系統時間與硬件時間就獨立運行,相互不影響,我們

通過應用程序獲取的時間用的都是操作系統時間。這一步是開機時 os 自動完成的。

2、主機運行過程中,通過 ntp 保證 osclock 與國際原子時同步,再將 osclock 同步到 hwclock。這一步需要自己配置實現

3、關機時,osclock 寫入 hwclock。這一步是關機時 os 自動完成的。不過我們要考慮異常關機的情況,當異常關機時,osclock 可能沒有寫入 hwclock,這就是為什

么在第 2 步中將 osclock 定時刷入 hwclock 的原因。如果不定時刷入,那 osclock 與 hwclock 差距比較大時,若異常關機,osclock 就丟掉了,再開機時,osclock 就是

錯誤的,在第一個 ntp 同步到來時,osclock 就一直是錯誤的。而且如果使用的是 ntpd,ntpd 是漸進調整,要經過多個 ntp 同步周期后才會將 osclock 調整為國際原子

時,另外,如果 osclock 與 ntp server 的時間差超過 1000 秒,那 ntp server 就不會更新 osclock 了。

ubuntu 修改時區和時間的方法

1. 首先查看時區:

codetc@webubuntu:~$ date -r
tue, 17 dec 2013 18:23:01 +0800

如果要修改時區,執行 sudo tzselect

2. 選擇區域:亞洲

codetc@webubuntu:~$ sudo tzselect
[sudo] password for codetc: 
please identify a location so that time zone rules can be set correctly.
please select a continent or ocean.
 1) africa
 2) americas
 3) antarctica
 4) arctic ocean
 5) asia
 6) atlantic ocean
 7) australia
 8) europe
 9) indian ocean
10) pacific ocean
11) none - i want to specify the time zone using the posix tz format.
#? 5

3. 選擇國家:中國

please select a country.
 1) afghanistan 18) israel 35) palestine
 2) armenia 19) japan 36) philippines
 3) azerbaijan 20) jordan 37) qatar
 4) bahrain 21) kazakhstan 38) russia
 5) bangladesh 22) korea (north) 39) saudi arabia
 6) bhutan 23) korea (south) 40) singapore
 7) brunei 24) kuwait 41) sri lanka
 8) cambodia 25) kyrgyzstan 42) syria
 9) china 26) laos 43) taiwan
10) cyprus 27) lebanon 44) tajikistan
11) east timor 28) macau 45) thailand
12) georgia 29) malaysia 46) turkmenistan
13) hong kong 30) mongolia 47) united arab emirates
14) india 31) myanmar (burma) 48) uzbekistan
15) indonesia 32) nepal 49) vietnam
16) iran 33) oman 50) yemen
17) iraq 34) pakistan
#? 9

4. 選擇時區:北京時間

please select one of the following time zone regions.
1) east china - beijing, guangdong, shanghai, etc.
2) heilongjiang (except mohe), jilin
3) central china - sichuan, yunnan, guangxi, shaanxi, guizhou, etc.
4) most of tibet   xinjiang
5) west tibet   xinjiang
#? 1

5. 確認驗證:

the following information has been given:
 china
 east china - beijing, guangdong, shanghai, etc.
therefore tz= asia/shanghai  will be used.
local time is now: tue dec 17 18:22:10 cst 2013.
universal time is now: tue dec 17 10:22:10 utc 2013.
is the above information ok?
1) yes
2) no
#? 1
you can make this change permanent for yourself by appending the line
 tz= asia/shanghai  export tz
to the file  .profile  in your home directory; then log out and log in again.
here is that tz value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
asia/shanghai

6. 復制文件到 /etc 目錄下

sudo cp /usr/share/zoneinfo/asia/shanghai /etc/localtime

7. 更新時間

sudo ntpdate time.windows.com

8. 修改時間以后,修改硬件 cmos 的時間

sudo hwclock --systohc

讀到這里,這篇“ubuntu 系統怎么修改時區和時間”文章已經介紹完畢,想要掌握這篇文章的知識點還需要大家自己動手實踐使用過才能領會,如果想了解更多相關內容的文章,歡迎關注丸趣 TV 行業資訊頻道。

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-07-15發表,共計3030字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 城市| 九台市| 信丰县| 安康市| 吕梁市| 县级市| 商水县| 常宁市| 大庆市| 根河市| 贵南县| 罗甸县| 越西县| 孙吴县| 名山县| 西丰县| 广东省| 社会| 新龙县| 巨鹿县| 赣州市| 吴川市| 谢通门县| 琼中| 澳门| 海城市| 德阳市| 临泽县| 康保县| 盱眙县| 土默特左旗| 龙胜| 灵武市| 宿州市| 辽中县| 昭通市| 抚顺市| 安仁县| 怀安县| 双桥区| 嘉定区|