• 解决Windows10与Ubuntu16.04双系统时间不一样问题


    原因分析

    Ubuntu默认是用硬件时间(RTC, real time clock),加上UTC(universal time)时区得到显示的时间。
    而Windows则默认用本地时间(local time),这导致Windows和Ubuntu双系统的时间显示不一致。

    具体表现:在Windows上通过关掉-开启网络同步时区,正确的显示了时间;重启进Ubuntu,时间显示也正确;但再次回到Win10发现时间少了8小时。

    解决办法

    方法1:改Ubuntu时间显示方式

    timedatectl set-local-rtc 1 --adjust-system-clock
    

    验证:

    timedatectl
    
    (base) 1080Ti% timedatectl
          Local time: 四 2020-05-14 18:52:11 CST
      Universal time: 四 2020-05-14 10:52:11 UTC
            RTC time: 四 2020-05-14 18:52:12
           Time zone: Asia/Shanghai (CST, +0800)
     Network time on: yes
    NTP synchronized: no
     RTC in local TZ: yes
    
    Warning: The system is configured to read the RTC time in the local time zone.
             This mode can not be fully supported. It will create various problems
             with time zone changes and daylight saving time adjustments. The RTC
             time is never updated, it relies on external facilities to maintain it.
             If at all possible, use RTC in UTC by calling
             'timedatectl set-local-rtc 0'.
    

    然后重启进入Windows,调整到正确时间。以后再进入Ubuntu或Windows都显示正确了。

    方法2:改Windows注册表

    不推荐这种方式,不过你如果坚持要用,也不妨一试:

    管理员方式打开cmd,执行如下命令:

    64位系统(目前绝大多数都是64位win10):

    Reg add HKLMSYSTEMCurrentControlSetControlTimeZoneInformation /v RealTimeIsUniversal /t REG_QWORD /d 1
    

    32位系统(如果你的电脑情况特殊,用了32位win10,此类情况很少见):

    Reg add HKLMSYSTEMCurrentControlSetControlTimeZoneInformation /v RealTimeIsUniversal /t REG_DWORD /d 1
    

    然后,关掉“网络更新”的时间选项,并且重启系统。

    参考

  • 相关阅读:
    jQuery的面试题
    DOM面试题
    JavaScript高级
    Bootstrap面试题
    ajax面试题
    CSS3面试题
    MySQL的列约束
    MySQL数据库介绍
    java数据类型之间的转换
    java中变量和标识符名命名规范
  • 原文地址:https://www.cnblogs.com/zjutzz/p/12890740.html
Copyright © 2020-2023  润新知