在安装ESX时在Time Zone会让你选择是否使用UTC,往往在很多人选中后会发现VM的时间会偏差8个小时,会给一些服务带来很大的影响,ESX的管理界面并没有给出更改Time Zone的选项,这样就需要我们SSHESX上更改clock的配置文件了.

 
       问了很多人如何更改UTC,大多告诉重新安装ESX,看了LINUX这方面配置后,终于发现更改UTC的方法,但是在网上又无意间看到一个深帖里有个更详细的方法,干脆把这位仁兄的东东拷贝出来并加入了hwclock参数帮助
 
1. 编辑 /etc/sysconfig/ 目录下的 clock 文件 , 修改内容为 :

 

ZONE="Asia/Shanghai" (以中国区为例,其它地区名称可以到/usr/share/zoneinfo/目录查看)  

   
UTC=false        (true 使用UTC,false反之)

ARC=false
 
运行命令:
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 

运行命令:
hwclock --systohc --localtime

4 用date命令来检查系统时间
 
note:
 
1.
hwclock参数
 

hwclock - query and set the hardware clock (RTC)

 

Usage: hwclock [function] [options...]

 

Functions:

  --help        show this help

  --show        read hardware clock and print result

  --set         set the rtc to the time given with --date

  --hctosys     set the system time from the hardware clock

  --systohc     set the hardware clock to the current system time

  --adjust      adjust the rtc to account for systematic drift since

                the clock was last set or adjusted

  --getepoch    print out the kernel's hardware clock epoch value

  --setepoch    set the kernel's hardware clock epoch value to the

                value given with --epoch

  --version     print out the version of hwclock to stdout

 

Options:

  --utc         the hardware clock is kept in coordinated universal time

  --localtime   the hardware clock is kept in local time

  --directisa   access the ISA bus directly instead of /dev/rtc

  --badyear     ignore rtc's year because the bios is broken

  --date        specifies the time to which to set the hardware clock

  --epoch=year  specifies the year which is the beginning of the

                hardware clock's epoch value

  --noadjfile   do not access /etc/adjtime. Requires the use of

                either --utc or --localtime

 
2.
UTC是协调世界时(Universal Time Coordinated)英文缩写,是由国际无线电咨询委员会规定和推荐,并由国际时间局(BIH)负责保持的以秒为基础的时间标度。UTC相当于本初子午线(即经度0)上的平均太阳时,过去曾用格林威治平均时(GMT)来表示.北京时间比UTC时间早8小时,以1999110000UTC为例,UTC时间是零点,北京时间为199911早上8点整。
 

GMT(Greenwich Mean Time)是格林尼治平时: 
由于地球轨道并非圆形,其运行速度又随着地球与太阳的距离改变而出现变化,因此视太阳时欠缺均匀性。视太阳日的长度同时亦受到地球自转轴相对轨道面的倾斜度所影响。为着要纠正上述的不均匀性,天文学家计算地球非圆形轨迹与极轴倾斜对视太阳时的效应。平太阳时就是指经修订后的视太阳时。在格林尼治子午线上的平太阳时称为世界时(UT0),又叫格林尼治平时(GMT)
 

为了确保协调世界时与世界时(UT1)相差不会超过0.9秒,有需要时便会在协调世界时内加上正或负闰秒。因此协调世界时与国际原子时(TAI)之间会出现若干整数秒的差别。位于巴黎的国际地球自转事务中央局(IERS)负责决定何时加入闰秒。


我们日常所用的北京时间既不是原子时(TAI),也不是世界时(UT1),而是协调世界时(UTC)。相对于以地球自转为基础的世界时来说,原子时是均匀的计量系统,这对于测量时间间隔非常重要,但世界时时刻反映了地球在空间的位置,这也是需要的。为兼顾这两种需要,引入了协调世界时(UTC)系统。UTC在本质上还是一种原子时,因为它的秒长规定要和原子时秒长相等,只是在时刻上,通过人工干预,尽量靠近世界时。