募直前进 發表於 2023-12-14 00:00:00

Windows和Ubuntu时间不一致的问题的解决方法

<p>
        <span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>在 Windows 中把时间设置正确了过后,回到在 Ubuntu 后系统的时间又不一样了,在 Ubuntu中把时间设置正确后进入 Windows 后,时间又不一致了。    </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>出现这种情况的原因是 Windows 和 Ubuntu它们在默认情况下看待硬件时间(主板上的BOIS显示的时间)的方式不一样。 知道了问题存在的原因,我们就来解决这个问题。</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>这个是一个关于时间的问题,我们就先来了解一下关于时间的概念</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>UTC即Universal Time Coordinated,协调世界时</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>GMT即Greenwich Mean Time,格林尼治平时</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>Windows 与 Linux 缺省看待系统硬件时间的方式是不一样的:</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>  * Windows把系统硬件时间当作本地时间(local time),即操作系统中显示的时间跟BIOS中显示的时间是一样的。</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>  * Linux/Unix/Mac把硬件时间当作 UTC,操作系统中显示的时间是硬件时间经过换算得来的,比如说北京时间是GMT+8,则系统中显示时间是硬件时间+8。</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>这 样,当PC中同时有多系统共存时,就出现了问题。假如你的 Ubuntu 和 Windows 中设置的时区都为北京时间东八区,而你在 Ubuntu中把当前系统时间更改为9:00AM。则此时硬件中存储的实际C时间是1:00AM。这时你重启进入Windows后,你会发现 windows系统中显示的时间是 1:00AM,比 Ubuntu 中慢了八个小时。同理,你在 Windows中更改或用网络同步了系统时间后,再到Ubuntu中去看,系统就会快了8小时。在实行夏令时的地区,情况可能会更复杂些。</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>在ubunut下联网后时间还未能自动调整过来, 可用一下方法修改:</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>让 Windows 把硬件时间当作 UTC</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>开始-&gt;运行-&gt;CMD,打开命令行程序(Vista则要以管理员方式打开命令行程序方可有权限访问注册表),在命令行中输入下面命令并回车</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>Reg add HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation /v RealTimeIsUniversal /t REG_DWORD /d 1</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>====================================================================</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>Ubuntu中不使用UTC时间,而启用本地时间</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>编辑</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>/etc/default/rcS</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>把其中的内容“UTC=yes”改成“UTC=no“,保存后重启系统就可以了</span></p>
頁: [1]
查看完整版本: Windows和Ubuntu时间不一致的问题的解决方法