V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
oneforall
V2EX  ›  Linux

请问大佬们 CentOS7 的时间时区问题

  •  
  •   oneforall · 2021-04-30 20:02:08 +08:00 · 1293 次点击
    这是一个创建于 1085 天前的主题,其中的信息可能已经有所发展或是发生改变。
    # timedatectl
    Local time: 六 2021-05-01 03:53:59 CST
    Universal time: 五 2021-04-30 19:53:59 UTC
    RTC time: 五 2021-04-30 19:53:58
    Time zone: Asia/Shanghai (CST, +0800)
    NTP enabled: yes
    NTP synchronized: no
    RTC in local TZ: no
    DST active: n/a

    我的时区确实已经选择上海,感觉 Local time 和 Universal time 反了过来,请问要怎么正确设置?
    7 条回复    2021-05-05 16:15:11 +08:00
    ysc3839
        1
    ysc3839  
       2021-04-30 20:08:40 +08:00 via Android
    没反吧?同步一下时间就好了。
    conanforever22
        2
    conanforever22  
       2021-04-30 20:14:36 +08:00
    linux 对 bios 里的时间(rtc)是按照 UTC 处理的, 看 timedatectl 的输出应该是 rtc 错了, 重新同步下时间之后 hwclock --systohc 更新 rtc 时间应该就好了
    conanforever22
        3
    conanforever22  
       2021-04-30 20:16:31 +08:00
    记得之前看过 windows 是把 rtc 当做本地时区处理的, linux 是按照 UTC 处理的, 是不是双系统, windows 发现时间不对然后调了之间之后出现的这种情况
    jousca
        4
    jousca  
       2021-04-30 20:16:40 +08:00
    如楼上,应该是时间没设置正确。

    UTC 是 19.53 分,你当前时区+8 是 北京时间。变成 5-1 03:53 是对的。

    所以原因就是你时间不正确。不是时区不正确。
    jousca
        5
    jousca  
       2021-04-30 20:18:02 +08:00
    要看 /etc/sysconfig/clock 里的 UTC 参数,如果 UTC=false,那时区有意义;如果 UTC=true,那时区没意义,实际上是 UTC 时间。
    youdoit
        6
    youdoit  
       2021-05-01 16:10:03 +08:00
    删除原来的 rm -rf /etc/localtime,然后做个软连接 ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime,在同步就行了
    root01
        7
    root01  
       2021-05-05 16:15:11 +08:00
    timedatectl 命令好使
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2710 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 05:34 · PVG 13:34 · LAX 22:34 · JFK 01:34
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.