linux 获取滴答时钟_如何获取Windows和Linux时钟以显示正确和匹配的时间? [双启动]...

linux 获取滴答时钟_如何获取Windows和Linux时钟以显示正确和匹配的时间? [双启动]...

linux 获取滴答时钟

linux 获取滴答时钟_如何获取Windows和Linux时钟以显示正确和匹配的时间? [双启动]...

Sometimes when you set up a dual-boot system, things can get a bit weird with the time and clock settings, so how do you fix the problem? Today’s SuperUser Q&A post has the perfect solution to help a frustrated reader fix his dual-boot clock woes.

有时,当您设置双引导系统时,时间和时钟设置可能会变得有些奇怪,那么如何解决该问题? 今天的超级用户问答文章提供了完美的解决方案,可以帮助沮丧的读者解决双启动时钟问题。

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

今天的“问答”环节由SuperUser提供,它是Stack Exchange的一个分支,该社区是由社区驱动的Q&A网站分组。

Photo courtesy of Straws pulled at random (Flickr).

照片由Straws随机拉(Flickr)提供

问题 (The Question)

SuperUser reader arielnmz wants to know how to get both of the clocks on his dual-boot Windows/Linux setup to display the proper, and matching, times:

超级用户阅读器arielnmz想知道如何在他的双引导Windows / Linux设置上获得两个时钟以显示正确的时间和匹配的时间:

Ever since I started using Linux in a dual-boot set up with Windows, I have noticed when I rebooted the machine, the time on the other operating system was wrong (for example, 12:00 on Linux, reboot to Windows and see 18:00). When I checked the BIOS, the RTC was set to 18:00.

自从我开始在与Windows一起设置的双引导中使用Linux之后,我就注意到当我重新引导计算机时,另一个操作系统上的时间是错误的(例如,在Linux上为12:00,重新引导到Windows并看到18 :00)。 当我检查BIOS时,RTC设置为18:00。

Since my time zone is -06:00 CST, I assume Linux just sets the RTC’s time to UTC and re-calculates the time based on the time zone whereas Windows just sets the RTC to the time for the time zone. Both use the same NTP server to synchronize the time.

由于我的时区是CST -06:00,因此我假设Linux只是将RTC的时间设置为UTC并根据时区重新计算时间,而Windows只是将RTC设置为时区的时间。 两者都使用同一台NTP服务器同步时间。

My question is, which one is doing the right thing? On which one should I set the time zone setting to UTC in order to have the right time on both?

我的问题是,哪个人在做正确的事情? 我应该在哪一个上将时区设置设置为UTC以便在两者上都有正确的时间?

What is the best method for fixing arielnmz’s dual-boot clock problem?

解决arielnmz的双启动时钟问题的最佳方法是什么?

答案 (The Answer)

SuperUser contributor Ayan Patra has the answer for us:

超级用户贡献者Ayan Patra为我们提供了答案:

I recently faced the same problem and this is how I fixed it. You need to make some minor changes in both operating systems.

我最近遇到了同样的问题,这就是我解决问题的方法。 您需要在两个操作系统中进行一些小的更改。

I started with Linux first. Run the following commands as root:

我首先开始使用Linux。 以超级用户身份运行以下命令:

  • ntpdate pool.ntp.org

    ntpdate pool.ntp.org

This will update your time if it is not set correctly.

如果时间设置不正确,这将更新您的时间。

Now set the hardware clock to UTC with this command.

现在,使用此命令将硬件时钟设置为UTC。

  • hwclock –systohc –utc

    hwclock –systohc –utc

Source

资源

Now boot to Windows and add the following to the registry. Simply create a .reg file using the code below in Notepad. Save it and run it.

现在启动Windows,并将以下内容添加到注册表中。 只需使用下面的记事本中的代码创建一个.reg文件。 保存并运行。

  • Windows Registry Editor Version 5.00

    Windows注册表编辑器版本5.00

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]

    [HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ TimeZoneInformation]

    “RealTimeIsUniversal”=dword:00000001

    “ RealTimeIsUniversal” = dword:00000001

Source

资源

From the next boot onward, both operating systems will show you the correct time.

从下一次引导开始,两个操作系统都将为您显示正确的时间。



Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

有什么补充说明吗? 在评论中听起来不错。 是否想从其他精通Stack Exchange的用户那里获得更多答案? 在此处查看完整的讨论线程

翻译自: https://www.howtogeek.com/211144/how-to-get-windows-and-linux-clocks-to-display-the-correct-and-matching-time-dual-boot/

linux 获取滴答时钟