Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of windows system time offset 8 hours in kvm

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you how to solve the kvm windows system time offset 8 hours problem, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

Phenomenon:

1. Private cloud systems use utc+0 time, and the clock source is tsc.

2. The newly created clock offset=localtime of windows CVM

3. If the CVM is not restarted, the internal time of the windows CVM changes from utc+8 time to utc+0 time.

4. The log appears on the windows CVM. The source kernel-general is 1, and the recording time is the current time. The recording content is to change the current utc+8 time into the utc+0 time (in other words, the original utc+0 time is regarded as the utc+8 time, and then the system time jumps to the past)

5. Windows Time service is not enabled (the default update time for windows is once a week)

Analysis:

1. The reason for the time change of windows CVM

First of all, determine the reason for the change of windows time. Generally, there are two kinds: (1) some software on windows changes the system time. (2) the system time changes with the hardware time.

This requires setting debug in win32Time in the windows system and installing software such as log dumps.

2. It is believed that the error of the CVM is caused by the system clock.

(1) rumor has it (this needs to study the startup process of the windows system): when the windows operating system starts, it will take the cmos time (hardware time) directly as the current system time, and will no longer be changed according to the time zone, so this time will be 8 hours slower than the normal time (the default is the host system time (the host time is utc+0), but what you need to know is The time change occurs during the operation of the CVM, and it is either powered on or incorrect. Of course, we need to understand the operation mechanism of win32Time, and it is possible that it will poll the hardware time.

(2) Simulation of guest machine clock by virtualization technology (because the clock of the host's virtualization system is not coordinated with the clock source of the guest machine)

Solution (to be verified):

1. Change the registry of the windows system, change the way the windows system treats the hardware time when starting up, and change the localtime to utc (this turns off the win32time service, it is true that the time will not shift by 8 hours after setting, but it is not sure whether there will be a time change during the run)

Log in to the windows virtual machine, click "start-run" when the run window pops up, enter "regedit" in the window, and click OK to open the registry

Enter "HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Control\ TimeZoneInformation\" to add a value of type REG_DWORD (the value for 64-bit systems is REG_QWORD), the name is RealTimeIsUniversal, and the value is set to 1.

2. Change the clock source of the windows CVM (from tsc to rtc) (it has been proved that the problem of windows system shifting 8 hours cannot be solved, but the time accuracy can be ensured as much as possible, that is, when the CVM is running, the time of the CVM will not shift too much without using ntp).

Run terminal as an administrator

Run bcdedit / set {default} USEPLATFORMCLOCK on

You can use bcdedit / enum {default} to view the results

3. Change the windows system time update frequency (the default windows time update frequency is once a week) (in addition, this method is not proposed by me, which is officially recommended by virtualized kvm, they suggest that both guest and host should run ntp update time). To be on the safe side, this time synchronization is necessary.

The default time synchronization time of windows is very long. It is better to change it to 3 minutes or every few minutes. The change method is

Registry regedit

[HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ W32Time\ TimeProviders\ NtpClient] branch, and double-click the SpecialPollInterval key to select the "cardinality" bar in the dialog box to "decimal". The value is the interval of automatic timing (in seconds). For example, the default 604800 is calculated by 7 (days) × 24 (hours) × 60 (minutes) × 60 (seconds). Set the time synchronization period (180), fill in the dialog box, and click OK to save and close the dialog box.

Stop the w32time service

Net stop w32time

Bcdedit / unregister

The above is all the contents of this article entitled "how to solve the problem of windows system time offset 8 hours in kvm". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report