An inconsistency between UTC time and CST time in Linux

Source: Internet
Author: User
Tags cst time

In order to learn, in the virtual machine to minimize the installation of CentOS6.7, when used to find the timestamp of the file is inconsistent with the actual time, with date to view the time display:

Friday, January 01, 2016 21:11:43 CST

Then the time displayed with Date-u is correct:

Friday, January 01, 2016 13:12:20 UTC

In order to solve this problem, found some solutions on the Internet, recorded as follows.

World Coordination Time (Universal times COORDINATED,UTC):


If you do not have an NTP server installed, you need to execute the following command first:

Yum-y Install NTP

Synchronization time using the Ntpdate command is as follows:

Ntpdate cn.pool.ntp.org


In the CentOS Linux Terminal command, execute the following command:

1) Vi/etc/sysconfig/clock #编辑时间配置文件

Zone= "Asia/shanghai"

Utc=false #设置为false, hardware clock is not the same as UTC time

Arc=false

2) Ln-sf/usr/share/zoneinfo/asia/shanghai/etc/localtime #linux的时区设置为上海时区

3) ntpdate cn.pool.ntp.org #对准时间

4)/sbin/hwclock--SYSTOHC #设置硬件时间和系统时间一致并校准

After the above steps, our CentOS Linux system time and computer hardware time are finally CST time, and are all in Shanghai time zone.


An inconsistency between UTC time and CST time in Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.