"Go" Workaround for Windows and Linux (Ubuntu) Two-system time inconsistency

Source: Internet
Author: User
Tags time zones set time apple operating systems

  When backing up files in embedded Linux, when the backup, the PC (Win7) and the Development Board time is 9:30, but the Development Board found that the file creation time is 9:30, and then the U disk inserted on the PC (Win7), found that the file creation time is 1:30, why the difference 8 hours?

World Coordination Time (Universal times COORDINATED,UTC), there are two kinds of time difference in GPS system, one is UTC, the other is LT (local time). The difference between the time zone is different, UTC is the time of the 0 time zone, local time, such as Beijing for the Morning Eight (east eight), UTC time is 0 points, time is eight hours later than in Beijing, in order to calculate.

  UTC is equivalent to the average sun on the Prime meridian (that is, longitude 0 degrees), in the past using Greenwich Mean Time (GMT) to represent. Beijing time is 8 hours earlier than UTC time, with January 1, 1999 0000UTC as an example, UTC time is 0 points, and Beijing time is January 1, 1999 8 o'clock in the morning. 

  GMT (Greenwich Mean time) is Greenwich: because the Earth's orbit is not circular, its operating speed changes with the distance between the Earth and the sun, so the lack of uniformity in the view of the sun. The length of the solar day is also affected by the inclination of the earth's axis of rotation relative to the orbital surface. To correct the inhomogeneity above, astronomers calculate the effect of the Earth's non-circular trajectory and polar axis tilt on the sun. When the sun is flat, it refers to the revised view of the sun. When the sun is flat on the Greenwich meridian, it is called World Time (UT0), also known as Greenwich Mean (GMT). Since the two systems set the time based on the time in the motherboard CMOS, but there are different time calculation standards. So it caused the system time dispute problem.

  Linux and Apple operating systems are based on the current motherboard CMOS time as Greenwich Mean Time, and then based on the time zone set by the system to finalize the current system time (such as when the time zone is set to gmt+08:00 Beijing time and the current CMOS time is 03:0 0, the system will add two time to the current system time displayed on the desktop is 11:00).

 The Windows operating system directly determines the CMOS time as the current display time, and is not converted according to the time zone. each time the system time zone is adjusted, the system calculates the current time according to the adjusted time zone, and then modifies the time within the CMOS (that is, once each time zone is adjusted, the CMOS time will be changed by the operating system once, after the different operating system adjustment time, will also change CMOS time, which is common).

Here we can solve the time contradiction between the Windows operating system and the different operating systems by only allowing Windows to determine CMOS time as Greenwich Mean time to eliminate the difference in time between operating systems, regardless of the good difference between the two time calculations.

In other words, UTC is Universal Time coordinated, coordinated world GMT is Greenwich MEAN times, Greenwich is here, you can think of UTC as gmt+0. The way Windows (XP and Vista) and (LINUX/UNIX/MAC) view system hardware time by default is different:

* Windows treats system hardware time as local time, that is, the time displayed in the operating system is the same as the time shown in the BIOS.

* Linux/unix/mac hardware time as UTC, the operating system display time is the hardware time after conversion, for example, Beijing time is gmt+8, the system display time is hardware time +8.

In this way, there is a problem when multiple systems coexist in the PC. If your Ubuntu and windowsxp have time zones set in the East eight zone of Beijing, you can change the current system time to 9:00am in Ubuntu. The actual UTC time 1:00am is stored in the hardware. When you reboot into Windows, you will find that the time shown in Windows is 1:am, which is eight hours slower than in Ubuntu. Similarly, after you change in Windows or synchronize the system time with the network, and then go to Ubuntu to see, the system will be 8 hours faster. In areas where daylight saving time is practiced, the situation may be more complicated. The reason knows, how to solve this kind of conflict. One is to have Windows keep the hardware time as UTC, consistent with Linux/unix/mac. The other is to let Linux/unix/mac take the system time as local time, consistent with Windows.

  The following methods are modified under Windows:
That is, adding a data type of REG_DWORD to the hkey_local_machine\system\currentcontrolset\control\timezoneinformation\, The name is realtimeisuniversal and the value is set to 1.
The following command line is also available:

@echo off
Color 0a
Reg Add hklm\system\currentcontrolset\control\timezoneinformation/v realtimeisuniversal/t reg_dword/d 1
Echo.
ECHO has enabled Windows to identify the time that is stored in the motherboard CMOS for Greenwich Mean Time (GMT), which is the time that the system determines the current system based on the CMOS time and the time zone set.
Echo.
Pause

  In Ubuntu, the following methods are modified:
In Ubuntu, you do not use UTC time, while local time is enabled, you need to modify/ETC/DEFAULT/RCS and modify the following actions:
In Ubuntu, open the terminal:
sudo gedit/etc/default/rcs//Here is set time with ("utc=").
Change: Utc=yes to: Utc=no Save to resolve issue

"Go" Workaround for Windows and Linux (Ubuntu) Two-system time inconsistency

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.