☰
Void Linux(runit)双系统时间不同步问题解决方案
2026/10/7 2:49:36 网站建设 项目流程

前言

在使用 Linux 与 Winodws 双系统时,往往会遇到切换系统时间不同步
这是因为 Windows 默认把主板RTC时间视作本地时间
而 Linux 通常将主板RTC时间作为标准时间,然后加上时区偏移

在Ubuntu下,设置timedatectl set-local-rtc 1就可以解决问题

但在 Void Linux 下,没有timedatectl命令,是通过直接配置/etc/rc.conf文件实现

网络上关于 Void Linux 相关配置教程的文章较少,所以在这里记录一下

设置过程

参照 Void Linux文档 可知,Void Linux时间标准通过HARDWARECLOCK环境变量控制,全局设置的话,直接修改/etc/rc.conf就行


在/etc/rc.conf可以找到这一行关于时间的设置:

# Set RTC to UTC or localtime.#HARDWARECLOCK="UTC"

去掉注释,改成localtime就可以了:

# Set RTC to UTC or localtime.HARDWARECLOCK="localtime"

这样再次重启使用双系统,时间就正常了

附录

如果此时重启后,仍发现系统存在时差,则需要手动设置一下时区,
在/etc/rc.conf修该如下:

# Set timezone, availables timezones can be found at /usr/share/zoneinfo.## NOTE: it's preferred to set the timezone in /etc/localtime instead:# - ln -sf /usr/share/zoneinfo/<timezone> /etc/localtime# Setting the timezone here requires a reboot to apply any changes/fixes# and read-write access to the filesystem.#TIMEZONE="Asia/Shanghai"

(当然,还有另一种方案:将Windows时间设为UTC读取,网上相关教程已经十分成熟,这里就不再赘述了)

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询