> For the complete documentation index, see [llms.txt](https://docs.verge.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verge.io/knowledge-base/zh/virtual-machines/windows-time-shift.md).

# Windows - 时间偏移

### 问题描述

运行 Windows 操作系统的 VergeOS 虚拟机（VM）可能会经历“时间偏移”，即来宾操作系统会定期将时间调整为错误的值。

#### 理解根本原因

此时间偏移问题源于 Windows 的预期与现代虚拟机监控器行为之间的根本不匹配。具体来说，时间偏移来自：

* **虚拟硬件时钟（RTC）** - 当 VM 启动时，Windows 会从模拟的实时时钟中读取时间，而 KVM/QEMU 会根据主机时间进行设置
* **初始时钟同步** - 这发生在 VM 启动时，Windows 读取的是虚拟 BIOS/CMOS 时钟，而不是通过任何代理

问题在于，Windows 期望硬件时间为本地时间，但现代虚拟机监控器（包括 KVM/QEMU）提供的是 UTC 时间。这是由 Windows 操作系统造成的，因为它期望物理主板提供的时间是本地时间（RTC），而不是协调世界时（UTC）。

VergeOS 以 UTC 提供时间，这已成为行业标准，因为它能补偿夏令时（DST）的变化。来宾操作系统在将自身时钟值与权威时间源比较时，会自动调整时间，因为它假定硬件提供的时间是本地时间而不是 UTC。由于来宾操作系统无法调整物理节点时钟以匹配其认为正确的时间，这种比较会导致周期性差异。

### VergeOS 配置选项：RTC Base

RTC Base 是一个单独的 VM 设置，允许 VergeOS 管理员将提供给操作系统的时间设置为本地时间或 UTC。编辑任意 VM 时都可以找到该值。

![替代文本](/files/183d3cadd6e4d55e7a95cf5af2745441656ea25c)

通过此配置设置，管理员可以精细控制每台机器，不过了解每个选项的预期行为非常重要。

#### 本地时间

将 RTC Base 设置为本地时间会把物理节点的时间传递给虚拟来宾操作系统。这模拟了 Windows 期望的旧式行为。当 Windows 将本地时间时钟与权威时间服务进行比较时，Windows 会根据 Windows 配置中定义的时区调整来宾操作系统内的时间。这可能会导致意外行为。

使用本地时间时需要考虑的事项：

* 物理节点的时区会以相同方式呈现给任何来宾操作系统。如果 VergeOS 承载的是位于不同时区的 VM，那么每个 Windows VM 都会将本地时间视为相同的值。
* 物理节点时间和来宾操作系统都需要正确配置，以避免每年夏令时（DST）开始或结束时出现问题。RTC 时钟需要通过软件进行调整。历史上，当 DST 的相关指导发生变化时，曾出现过问题。

#### UTC 时间

将 RTC Base 设置为 UTC 会把物理节点的时间以协调世界时的形式传递到来宾 VM。这是处理时间的现代软件应用所采用的行业标准。

在 VergeOS 中使用 UTC 设置时，应将 Windows VM 配置为识别所显示的时间是通用时间。对于大多数 Windows 操作系统，可通过在 Windows 注册表中添加一个值来识别“RealTimeIsUniversal”完成此调整。

注册表修复 `RealTimeIsUniversal=1` 是最优雅的解决方案，因为它：

* **明确告诉 Windows 它接收到的时间格式是什么**
* **消除了虚拟机监控器与 Windows 时间服务之间的持续冲突**
* **可与域控制器和 NTP 同步配合使用**

**适用于 64 位操作系统**

在注册表项 `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation`下，需要有一个 `REG_QWORD` 条目，并使用以下值：

* **名称：** RealTimeIsUniversal
* **数值数据：** 1

调整此设置后，管理员需要先完全关闭 VM，然后再开启 VM，变更才会生效。

{% hint style="info" %}
**重要提示**

对来宾操作系统或应用程序进行软件调整时，管理员应查阅该软件的生产环境文档，包括最新的 KB 文章、更新和发行说明。
{% endhint %}

### 关于此主题的延伸阅读

* 可以安装 <https://www.meinbergglobal.com/english/sw/ntp.htm，并将其设置为从> <https://tf.nist.gov/tf-cgi/servers.cgi> 中列出的任意服务器获取时间。Meinberg NTP 软件可设置为按小时、每日、每周等频率校正时间。这样你就可以“设置好后忘掉它”。
* 有关此问题历史的更多信息，包括 Windows 中变更的时间顺序，可在此处找到：<https://www.cl.cam.ac.uk/\\~mgk25/mswish/ut-rtc.html>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.verge.io/knowledge-base/zh/virtual-machines/windows-time-shift.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
