有关 Linux 时区

2022-07-18 11:53:18 +08:00
 koebehshian

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

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

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

1376 次点击
所在节点    Linux
3 条回复
julyclyde
2022-07-18 12:37:01 +08:00
你看的这一篇文档标题叫 Specifying the Time Zone with TZ

应该思考一下,without 该怎么办呢
julyclyde
2022-07-18 12:43:50 +08:00
仔细读,仔细读
如果没明白就把文档再读一遍
lcdtyph
2022-07-18 12:44:58 +08:00
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 空的时候就去读你说的路径了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/866959

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX