Set the time zone in Linux

Source: Internet
Author: User

Host environment: Gentoo Linux 3.1.10
 
Because windows and linux systems set time based on the time in the motherboard CMOS, but there are different time computing standards. This leads to system time disputes.
Linux uses the current motherboard CMOS time as the Greenwich Mean Time, determine the current system time based on the time zone set by the system (for example, when the time zone is set to GMT + Beijing time and the Current CMOS time is, then, the system adds the two times to obtain that the current system time displayed on the desktop is ).
In Windows, the CMOS time is regarded as the current display time and is not converted based on the time zone. In this way, each time the system time zone is adjusted, the system calculates the current time based on the adjusted time zone. After the time is determined, the time in the CMOS is also modified (that is, every time the time zone is adjusted, after the settings are saved, the CMOS time will also be changed once by the operating system. Note that after the time is adjusted for different operating systems, the CMOS time will also be changed at the same time, which is common ).
Universal Time Coordinated
GMT is Greenwich Mean Time, Greenwich Mean Time
Here, you can consider UTC as GMT + 0. By default, Windows and (Linux/Unix/Mac) have different ways of viewing the system hardware time:
* In Windows, the system hardware time is treated as the local time, that is, the time displayed in the operating system is the same as the time displayed in the BIOS.
* Linux/Unix/Mac uses the hardware time as UTC. The time displayed in the operating system is converted by the hardware time. For example, Beijing time is GMT + 8, the time displayed in the system is hardware time + 8.
In this way, a problem occurs when multiple systems coexist in the PC. Assume that the time zone set in Linux and Windows XP is UTC + 8 Beijing time, and you change the current system time to AM in Linux. In this case, the hardware actually stores the UTC time AM. After you restart and enter Windows, you will find that the time displayed in windows is 1: AM, eight hours slower than in Linux. Similarly, after you change the system time in Windows or use the network to synchronize the system time, and then go to Linux to see it, the system will be 8 hours faster.
After changing the time on windows, sometimes it will be automatically changed back. Therefore, it is best to modify it in linux:
The following is the modification method:
Set Linux time zone
1. Set localtime under/etc/
Copy or link
 
Cp/usr/share/zoneinfo/Asia/Shanghai/etc/localtime
 
2. Modify/etc/conf. d/hwclock
 
Clock = "local"


Yan Ming, author

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.