用linux的時候大家可能會遇到時間不對,時區不對的情況。比如使用網上廉價的國外的linux的vps,時區是國外的。那么如何在不勞煩管理員的情況下自己動手呢?首先要了解硬件時鐘與系統時鐘,計算機上的BIOS時間,這還得google一番,詳情可參見http://kerrigan.sinaapp.com/post-6.html。當然了對于咱們來說會幾個命令就行了:hwclock -s --localtime讓硬件時間使用本地時間即可。[root@remote ~]# hwclock --helphwclock - query and set the hardware clock (RTC)Usage: hwclock [function] [options...]這里需要大家特別注意:先是函數后是參數,只用其中一個是沒有用的,這是解決問題的關鍵Functions: -r | --show read hardware clock and PRint result #讀取硬件(BIOS)時間,并顯示出來 -s | --hctosys set the system time from the hardware clock #把目前系統時間調整為硬件時間 -w | --systohc set the hardware clock to the current system time #把硬件時間調整為目前系統的時間 --systz set the system time based on the current timezone #把系統時間設置為當時時區的時間Options: -u | --utc the hardware clock is kept in UTC #設置硬件為的UTC時間 --localtime the hardware clock is kept in local time #設置硬件為本地時
新聞熱點
疑難解答