Linux时区、时间的更改
上一篇 / 下一篇 2010-02-21 18:23:10 / 个人分类:liunx相关
#e2I&w5i;zZI0Linux 时钟分为系统时钟(System Clock)和硬件(Real Time Clock ,简称RTC )时钟。系统时钟是指当前Linux Kernel中的时钟,而硬件时钟则是主板上由电池供电的时钟,这个硬件时钟可以在BIOS中进行设置。当Linux 启动时,硬件时钟会去读取系统时钟的设置,然后系统时钟就会独立于硬件运作。
;\VN Y DNR"v`0
R9pf?Jz!}0 Linux中的所有命令(包括函数)都是采用的系统时钟设置。在Linux中,用于时钟查看和设置的命令主要有date、hwclock和clock。其中,clock和hwclock用法相近,只用一个就行,只不过clock命令除了支持x86硬件体系外,还支持Alpha硬件体系。
}4K{8\]KakE0
7v1T$An,TrbU(r0 1、date51Testing软件测试网7J
q/_OR~7|0P
51Testing软件测试网X5gi,~8lK_
查看系统时间
BjqSxNn.CeNT0
@bT$h9~9uhW0 # date
M$V\-gQf$~p\0 51Testing软件测试网a*mA(|B3}&P
设置系统时间51Testing软件测试网fX;Se1Ge8l
_GZm2kXJXU}0 # date --set “07/07/06 10:19" (月/日/年时:分:秒)51Testing软件测试网.D)Y+ab5Ar
|a2P
51Testing软件测试网(FI)fa{t9Z1hC7x
2、hwclock/clock
Iw+x"kQ
@"Xx0 51Testing软件测试网w#a6vhih
Cv
查看硬件时间51Testing软件测试网1A!HDqX8z8M
51Testing软件测试网W%Sb"x$t%da#d
# hwclock --show
6`+S{&p_.|"b0 51Testing软件测试网x1G3m0},`B
或者# clock --show
FK'O0f v9b5HVA0 51Testing软件测试网sK0tU2t
设置硬件时间
$m;`Eh
s$e4SX0 51Testing软件测试网Vi.s3[ U7F YM&r}
# hwclock --set --date="07/07/06 10:19" (月/日/年 时:分:秒)
Y
RL:qJ
A&x[0
jUf0v?gP0 或者# clock --set --date="07/07/06 10:19" (月/日/年 时:分:秒)51Testing软件测试网`6bMC3{L(y
51Testing软件测试网W
wB
VGc
3、硬件时间和系统时间的同步
:da4m9t?l0 51Testing软件测试网`Ze3Ox+?O/[gVH:E
按照前面的说法,重新启动系统,硬件时间会读取系统时间,实现同步,但是在不重新启动的时候,需要用hwclock或clock命令实现同步。51Testing软件测试网Z6Xe YAw
51Testing软件测试网 CV
bMn
硬件时钟与系统时钟同步:# hwclock --hctosys(hc代表硬件时间,sys代表系统时间)或者# clock --hctosys
8EIb%cSd0 51Testing软件测试网0n?:f#Je"|3qSJ~ L
系统时钟和硬件时钟同步:# hwclock --systohc或者# clock --systohc51Testing软件测试网b e
_,HX![%~8q
9JCY;['Lq C0 4、时区的设置51Testing软件测试网.j;prX:ufjY\
N(@({1si#k0 # tzselect51Testing软件测试网+M1^|.S7[
/[sh2O
d)gkx0 Please identify a location so that time zone rules can be set correctly.Please select a continent or ocean51Testing软件测试网`sY[i~L w
!F1t,IY4ar]0 1) Africa51Testing软件测试网,`Ep"[ E$vw2o
51Testing软件测试网 a;\8NV*F]#p Y2) Americas51Testing软件测试网Q!O/g iW+oB
51Testing软件测试网y8g'[b~_;U3) Antarctica
ca_ F-E)K051Testing软件测试网bv$Vb&OeT\9I4) Arctic Ocean
4`$VR-R}7}2S3q1S051Testing软件测试网+o4P F(A x"Ig'Ya5) Asia
M+{i4q}N;R051Testing软件测试网/H^~'L?L1v(E E6) Atlantic Ocean
*p:qaH9l? I051Testing软件测试网cCMEur7) Australia51Testing软件测试网$` lSc-Z;su.SP9x
51Testing软件测试网8eC4X~ Xu5v8) Europe
&tgMX.a N/][^0v?1`9_M~0 9) Indian Ocean
t,Q%e'Ey.l051Testing软件测试网\H1`:B:HM10) Pacific Ocean51Testing软件测试网/h:KP3Q)edn
51Testing软件测试网/Q {6~7gE)il11) none - I want to specify the time zone using the Posix TZ format.
4O6C;Ea-|:l j8S0[7?^#q2n ` a7g%i
Y0 输入5,亚洲51Testing软件测试网:{8S;Dw,n-b
!_eMtk@w~!{7b0 Please select a country51Testing软件测试网f _0} Uj*KC lOoBa
3rZa:qM/}V0 1) Afghanistan51Testing软件测试网*H$^i9I7y!o g.k;D
S\'Lc+C;G&~N0 18) Israel
G1@gV;oX7~tVK,}051Testing软件测试网 I,z!B/L x5B35) Palestine51Testing软件测试网"dg j2LH S`
51Testing软件测试网 rp}/wE2V(n3S1S2) armenia51Testing软件测试网x+rr4@ }
f]:],n5T`}!h0 19) Japan51Testing软件测试网"~V1zf2L#zW([
51Testing软件测试网 [,L+~2wv'Yr36) Philippines51Testing软件测试网W'q-`7u^&[(el)~ ?
51Testing软件测试网`i ~|+J3j/K3) Azerbaijan
)|,]"R8|F.A;v8L:?D k051Testing软件测试网,a8RwY2D5l20) Jordan
!u3Zz9if.d1AY$W3|051Testing软件测试网?0G|X ?s37) Qatar
$a tQ KMCm9q"\+`0c7k x3Ciqp Ic0 4) Bahrain
#Yql)^)I(|Is051Testing软件测试网m.n!z_{Z:V3Jp I21) Kazakhstan
e4A ~-X5R8A}W051Testing软件测试网MI7|!qxy:]^E38) Russia51Testing软件测试网b&GC#?L
X0|,Nsj.\O3e8?0 5) Bangladesh51Testing软件测试网*K9q!qr z_B,Q
8?yu'T7el-L0 22) Korea (North)
t6Dax-@fI0dL0l `;?2a.QMl(`3G4f0 39) Saudi Arabia51Testing软件测试网"yj6ov(D/l-bs
){Qq2Z*vi)g;p:U a0 6) Bhutan51Testing软件测试网0f,x8}O^&U
51Testing软件测试网/{8_2H n-n wG23) Korea (South)
Q\5\\H051Testing软件测试网-Z!Y6\b}40) Singapore51Testing软件测试网r\.^"Rb QUl
51Testing软件测试网2Dg#H |/I7) Brunei51Testing软件测试网@\ m6CePW$d4mr
|%wE.S:P`m0 24) Kuwait
%WR'K{*[h_0[vg1rk/D+T7bx0 41) Sri Lanka
A-X4i5}#Q8C,q051Testing软件测试网C;y"EW2\4y@"?8) Cambodia51Testing软件测试网rKZ2s%x(jL
g]p5Xr { XW0 25) Kyrgyzstan51Testing软件测试网;V,I-t9Yl}
51Testing软件测试网,N*C\g3y?Wv42) Syria
bN$u4B*o#e051Testing软件测试网{yn%y'C9) China
2?#l4e9@/|l D.n;z.jQ08} h^8a?1jv0 26) Laos51Testing软件测试网%v%Y$Dne7}
7q|/l{l.@rDQ0 43) Taiwan
&jrWMeiH'I^ m051Testing软件测试网3[z'\ T7q10) Cyprus51Testing软件测试网D.fh,t]%a-v4I~ G X
-l5E&AI.kqt pX0 27) Lebanon51Testing软件测试网U"RH9F]3r
4@ I$X^B(ey)[H$k.LK0 44) Tajikistan51Testing软件测试网,q YG4cR?
a-V5u!`I\0 11) East Timor
-@(t,Rs J!jO#E)U00[%Fz ET+M0 28) Macau
9G#D0BM$EQ+xO0_7_(] a s&nN{4x'x0 45) Thailand51Testing软件测试网w:q H3k!r4UY
51Testing软件测试网V)}Q!?P _/g12) Georgia
'w xsud)HK"]V051Testing软件测试网2~:k P2dbn2\.U(z29) Malaysia
UW"tTv5k0x-F,J"_']K0 46) Turkmenistan
V[tK)ez+q0pp0ge9UNw0 13) Hong Kong51Testing软件测试网T4FZ'C xx fI
(@r&a(k,n.ut6N0 30) Mongolia
!gM's'|8X_S0p/`Zh&v0Ve2y0 47) United Arab Emirates51Testing软件测试网!pbk!SPm
6|K"[P6z6ws0 14) India
`n7E$o9P"Y051Testing软件测试网;\yJ&a?q`$w,l31) Myanmar (Burma)