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

有关 Linux 时区

  •  
  •   koebehshian · 2022-07-18 11:53:18 +08:00 · 1353 次点击
    这是一个创建于 638 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我查了GNU C 库手册,是通用 TZ 环境变量来设置的。在一台没有 systemd 的 arm 上测试 OK 。

    但是普通的 X86 UBUNTU 用的是 /etc/localtime 配置文件 参考freedesktop 用 TZ 变量可以覆盖。

    但明明 C 库只使用 TZ 环境变量,/etc/localtime 是如何生效的,是有个服务吗。

    julyclyde
        1
    julyclyde  
       2022-07-18 12:37:01 +08:00
    你看的这一篇文档标题叫 Specifying the Time Zone with TZ

    应该思考一下,without 该怎么办呢
    julyclyde
        2
    julyclyde  
       2022-07-18 12:43:50 +08:00   ❤️ 1
    仔细读,仔细读
    如果没明白就把文档再读一遍
    lcdtyph
        3
    lcdtyph  
       2022-07-18 12:44:58 +08:00 via iPhone   ❤️ 1
    If the TZ environment variable does not have a value, the operation chooses a time zone by default. In the GNU C Library, the default time zone is like the specification ‘TZ=:/etc/localtime’ (or ‘TZ=:/usr/local/etc/localtime’, depending on how the GNU C Library was configured; see Installing the GNU C Library). Other C libraries use their own rule for choosing the default time zone, so there is little we can say about them.

    TZ 空的时候就去读你说的路径了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1224 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 18:13 · PVG 02:13 · LAX 11:13 · JFK 14:13
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.