【环境问题】双系统开发机 Windows 时间慢 8 小时(RTC 时钟解读冲突) #5

Closed
opened 2026-09-25 07:03:35 +08:00 by fourbroad · 0 comments
Owner

现象: 双系统(Linux + Windows)开发机上,Windows 系统时间比标准北京时间慢整整 8 小时,日期相差一天,且 Windows 时间服务从未成功同步(源一直为 Local CMOS Clock)。

根因: 两个系统对硬件时钟(RTC)的解读不一致——Linux 默认将 RTC 存为 UTC,而 Windows 默认将 RTC 当作本地时间(UTC+8)解读,导致从 Linux 切回 Windows 后时间偏差恰好 8 小时。

影响: HTTPS 证书校验异常、git 提交时间戳错位、构建产物时间不可信、定时任务/日志时序混乱。

已做的修复(临时): 重新配置 NTP 源(ntp.aliyun.com、time.windows.com)并强制同步,时间已校准,后续自动对时。但每次从 Linux 切回 Windows 问题会复发。

永久方案(建议执行其一):

Linux 侧统一为本地时间:timedatectl set-local-rtc 1(推荐,对 Windows 侵入最小);
或 Windows 侧改为按 UTC 解读:注册表 HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation 新建 DWORD RealTimeIsUniversal = 1。
建议: 所有双系统开发机统一 RTC 策略,并确保 Windows 时间服务 NTP 同步正常开启。

现象: 双系统(Linux + Windows)开发机上,Windows 系统时间比标准北京时间慢整整 8 小时,日期相差一天,且 Windows 时间服务从未成功同步(源一直为 Local CMOS Clock)。 根因: 两个系统对硬件时钟(RTC)的解读不一致——Linux 默认将 RTC 存为 UTC,而 Windows 默认将 RTC 当作本地时间(UTC+8)解读,导致从 Linux 切回 Windows 后时间偏差恰好 8 小时。 影响: HTTPS 证书校验异常、git 提交时间戳错位、构建产物时间不可信、定时任务/日志时序混乱。 已做的修复(临时): 重新配置 NTP 源(ntp.aliyun.com、time.windows.com)并强制同步,时间已校准,后续自动对时。但每次从 Linux 切回 Windows 问题会复发。 永久方案(建议执行其一): Linux 侧统一为本地时间:timedatectl set-local-rtc 1(推荐,对 Windows 侵入最小); 或 Windows 侧改为按 UTC 解读:注册表 HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation 新建 DWORD RealTimeIsUniversal = 1。 建议: 所有双系统开发机统一 RTC 策略,并确保 Windows 时间服务 NTP 同步正常开启。
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Octopus/octopus-release#5