![在 Debian Linux 中禁用夏令时](https://linux22.com/image/52696/%E5%9C%A8%20Debian%20Linux%20%E4%B8%AD%E7%A6%81%E7%94%A8%E5%A4%8F%E4%BB%A4%E6%97%B6.png)
我不希望我的系统使用夏令时。
root@ali-debserver:~# cat /etc/timezone
Asia/Tehran
root@ali-debserver:~# cat /etc/default/rcS
#
# /etc/default/rcS
#
# Default settings for the scripts in /etc/rcS.d/
#
# For information about these variables see the rcS(5) manual page.
#
# This file belongs to the "initscripts" package.
# delete files in /tmp during boot older than x days.
# '0' means always, -1 or 'infinite' disables the feature
#TMPTIME=0
# spawn sulogin during boot, continue normal boot if not used in 30 seconds
#SULOGIN=no
# do not allow users to log in until the boot has completed
#DELAYLOGIN=no
# be more verbose during the boot process
#VERBOSE=no
# automatically repair filesystems with inconsistencies during boot
#FSCKFIX=no
我无法用ntp
或永久解决这个问题tzdate
。如何禁用夏令时?
答案1
提供了不受 DST 约束的时区定义,仅定义 GMT 偏移量,称为Etc/GMT±X
:
$ date
Mon Apr 7 11:08:56 CEST 2014
$ TZ=Etc/GMT-1 date
Mon Apr 7 10:09:16 GMT-1 2014
$
只需链接/复制您需要的内容/etc/localtime
,您就应该没问题并且不受 DST 影响:
$ ln -s /usr/share/zoneinfo/Etc/GMT-1 /etc/localtime
编辑:对于非整数偏移量,您将需要自己解决。您可以构建自己的区域文件来定义所需的偏移量:将以下行放入文件中:
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Tehran-nodst 3:25:44 - LMT 1916
3:25:44 - TMT 1946 # Tehran Mean Time
3:30 - IRST 1977 Nov
4:00 - IRST 1979
3:30 - IRST
并运行
$ zic -d . <filename>
这将生成一个Tehran-nodst
在当前目录中调用的文件,您可以复制到该文件/usr/share/zoneinfo/Asia
并链接/复制到该文件/etc/localtime
(仅执行最后一次复制也完全没问题)。
答案2
答案3
只需删除 /etc/localtime (或备份它 mv /etc/localtime /etc/localtime.back),创建一个指向您的时区的链接,如下所示:
ln -s /usr/share/zoneinfo/Asia/Tehran /etc/localtime