解决Windows和Linux双系统时间不一致的问题
默认情况下 Windows 认为 BIOS 时间为本地时间,而 Linux 则认为 BIOS 时间为 UTC 时间。因此在进行双系统切换后往往导致时间差几个小时的问题。下面是两种方案,任选其一即可。
Make Windows use UTC
Note: This method was not initially supported on Windows Vista and Server 2008, but came back with Vista SP2, Windows 7 and Server 2008 R2.
To make MS Windows calculate the time from the hardware clock as UTC.
Via regedit:
Run regedit
and navigate to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
Right-click in the right-side panel and select New > DWORD Value
. Create the key named RealTimeIsUniversal
and give it a value of 1
.
Using a registry file
Create a file named WindowsTimeFixUTC.reg
with the following contents and then double click on it to merge the contents with the registry:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
"RealTimeIsUniversal"=dword:00000001
Make Linux use ‘Local’ time
To tell your Ubuntu system that the hardware clock is set to ‘local’ time:
-
edit
/etc/default/rcS
-
Set
UTC=yes
if your hardware clock is set to UTC (GMT), orUTC=no
to have the hardware clock set to local time.
It’s come to my attention that this issue also affects Macs which dual boot via bootcamp
or other methods.
Reference
https://mikebeach.org/2011/04/10/windows-linux-dual-boot-system-time-issues/
补充
Ubuntu 16.04 使用 systemd 启动之后,时间也改成了由 timedatectl 来管理,而时间同步也由 timedatectl 进行管理,不再使用 ntpdate。改为执行:
sudo timedatectl set-local-rtc 1 --adjust-system-clock
上一篇: Handler小结
下一篇: (转)handler使用小结
推荐阅读
-
Linux和windows中的换行符差异问题
-
vue-cli2打包前和打包后的css前缀不一致的问题解决
-
mysql 忘记密码的解决方法(linux和windows小结)
-
Windows 64 位 mysql 5.7以上版本包解压中没有data目录和my-default.ini及服务无法启动的快速解决办法(问题小结)
-
Windows与Linux换行符差别所引起的问题的解决方法
-
windows安装多个版本的jdk,解决java-version和javac-version版本不一致的问题
-
mac双系统时间不一致怎么办 mac双系统时间不一致的原因以及解决方法
-
Linux和windows中的换行符差异问题
-
Linux与Windows编码不一致的解决方案
-
MyBatis查询时属性名和字段名不一致问题的解决方法