从 Ubuntu 切换到 Windows 10 后,时钟显示错误的时间

Bri*_*ore 106 time windows-10 16.04

我在 UEFI 模式下双启动了 Windows 10 和 Ubuntu 16.04(安全启动关闭)。我在 BIOS 中的时间是正确的。

当我启动到 Ubuntu 然后启动到 Windows 10 时,它显示了错误的时间。我必须在 Windows 10 中手动或通过 Internet 更正它,当我重新启动到 Windows 10 时,这不是问题。时钟将显示正确的时间。然后,当我重新启动到 Linux 时,时钟是正确的,但切换回 Windows 10 时,时钟又混乱了。

Ced*_* EI 118

多个引导系统时间冲突

操作系统在位于主板上的硬件时钟中存储和检索时间,以便即使在系统断电时它也可以跟踪时间。大多数操作系统(Linux/Unix/Mac)默认将硬件时钟上的时间存储为UTC,尽管有些系统(特别是 Microsoft Windows)将硬件时钟上的时间存储为“本地”时间。如果两个系统以不同的方式查看硬件时钟,这会导致双引导系统出现问题。

将硬件时钟设为 UTC 的优势在于,在时区之间移动或夏令时 (DST) 开始或结束时,您无需更改硬件时钟,因为 UTC 没有 DST 或时区偏移。

将 Linux 改为使用本地时间比将 Windows 改为使用 UTC 更容易也更可靠,因此双引导 Linux/Windows 系统倾向于使用本地时间。

自 Intrepid (8.10) 起,UTC=yes 是默认值。

解决方案 1:让 Windows 使用 UTC

注意:此方法最初在 Windows Vista 和 Server 2008 上不受支持,但在 Vista SP2、Windows 7、Server 2008 R2 和 Windows 8/8.1 上又回来了。

使 MS Windows 将硬件时钟的时间计算为 UTC。

使用以下内容创建一个名为WindowsTimeFixUTC.reg的文件,然后双击它以将内容与注册表合并:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
 "RealTimeIsUniversal"=dword:00000001
Run Code Online (Sandbox Code Playgroud)

注意:Windows 时间服务仍然会在关机时将本地时间写入 RTC,无论上面的注册表设置如何,因此使用此命令禁用 Windows 时间服务很方便(如果在 Windows 中使用任何第三方时间时仍需要时间同步同步解决方案):

sc config w32time start= disabled
Run Code Online (Sandbox Code Playgroud)

如果在 Powershell 中运行上述命令,则必须指定 sc.exe:

sc.exe config w32time start= disabled
Run Code Online (Sandbox Code Playgroud)

逆转变化

您可以创建一个包含以下内容的文件,然后双击它以合并原始更改,如上:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
 "RealTimeIsUniversal"=-
Run Code Online (Sandbox Code Playgroud)

如果禁用了 Windows 时间服务,请使用以下命令再次启用它:

sc config w32time start= demand
Run Code Online (Sandbox Code Playgroud)

解决方案 2:让 Linux 使用“本地”时间

告诉您的 Ubuntu 系统硬件时钟设置为“本地”时间:

Ubuntu 15.04 之前的系统(例如 Ubuntu 14.04 LTS):

  1. 编辑 /etc/default/rcS
  2. 添加或更改以下部分

    # Set UTC=yes if your hardware clock is set to UTC (GMT)
    UTC=no
    
    Run Code Online (Sandbox Code Playgroud)

Ubuntu 15.04 及以上系统(例如 Ubuntu 16.04 LTS):

  1. 打开终端并执行以下命令

    timedatectl set-local-rtc 1
    
    Run Code Online (Sandbox Code Playgroud)

来源:Ubuntu 帮助