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
The following information has been given:
China
east China - Beijing, Guangdong, Shanghai, etc.
Therefore TZ='Asia/Shanghai' will be used.
Local time is now: Sat Dec 13 00:59:53 CST 2014.
Universal Time is now: Fri Dec 12 16:59:53 UTC 2014.
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
[root@bidevelop4 ~]#
[root@BIAPP ~]# export TZ='Asia/Shanghai'
  ---这里其实可以写到.bash_profile里面
  上面的提示已经很清楚了,不需要我多解释了。
  不过我发现,修改了之后,还有不能生效,因为只是改了时区,服务器分为硬件时间和系统时间。所以设定了时区,还要确定Linux的时间方案。
  学习一下:
  Linux支持UTC时间,Coordinated Universal Time,也是世界协调时,也是本初子午线上的时间,它和以前的格林威治标准时(GMT)的区别似乎是它是由多个原子钟平均出来的。在 /etc/default/rcS这个文件中,设定了系统是否使用UTC,UTC=yes是用。
  计算机自己还有自己的时间,也是硬件时间,hard clock,也是存在BIOS里那个时间,关机也不会丢失。
  计算机启动时,要读取这个时间。这个时间如果设定为UTC(GMT),也是伦敦那地方的时间,要在rcS文件中设定UTC=yes,反之则要设为no。
  一般来讲,BIOS里面都设定为当地时间,这是因为如果装双系统的话,Windows似乎不懂UTC,会出问题。这时UTC=no。
  (a).网上说法:时区的配置,主要是两个文件:
  /etc/localtime
  /etc/timezone
  timezone这个文件是个文本,里面只需要写一行自己的时区行,我们这里是上海(Asia/Shanghai)
  localtime这个文件的类型不清楚,里面写了些timezone data,它可以从系统自带时区文件那里拷贝,位置在:/usr/share/zoneinfo
  从这个目录下找到Shanghai拷贝到/etc下的localtime即可,同样也可以做个联接,也是同样效果
  (b).网上说法:修改时间的配置文件时/etc/default/rcS
  但是我在我的系统里面没有找到这个文件。
  2、修改时间
  修改好了时区后,我们可以手动的修改时间,或者可以做一个时间同步:
  [root@BIAPP ~]#  /usr/sbin/ntpdate pool.ntp.org   ---- 这是和中国授时中心同步
  好是做一个自动任务,每天凌晨自动做一次同步。
  我这里在同步了时间之后,先查看硬件时间是否正确,如果不正确修改硬件时间。
  Linux读取这个硬件时间要用到hwclock这个命令:
  hwclock --show :显示硬件时间
  hwclock --systohc :将系统时间写入硬件
  hwclock --hctosys :将硬件时间写入系统时间
  这样服务器的硬件和系统时间全部都修改一致,同时修改了时区。我想应该不会出现之前的时差吧!