Linux – Disable Daylight Saving Time (DST) Changes in Linux

daylight-savinglinuxtimezone

A few weeks ago, it is announced (by The Energy and Natural Resources Ministry of Turkey) that DST will be permanent and GMT+3 will be used forever in the country.

Currently, timezone of our Linux servers is set to Europe/Istanbul. But no tzdata update is released yet.

Due to lack of update, timezone will be changed from GMT+3 to GMT+2 on 30 October 2016 automatically as declared in zoneinfo file (/usr/share/zoneinfo/Europe/Istanbul).

You can see the details for 2016 below:

# zdump -v /usr/share/zoneinfo/Europe/Istanbul | grep 2016
/usr/share/zoneinfo/Europe/Istanbul  Sun Mar 27 00:59:59 2016 UT = Sun Mar 27 02:59:59 2016 EET isdst=0 gmtoff=7200
/usr/share/zoneinfo/Europe/Istanbul  Sun Mar 27 01:00:00 2016 UT = Sun Mar 27 04:00:00 2016 EEST isdst=1 gmtoff=10800
/usr/share/zoneinfo/Europe/Istanbul  Sun Oct 30 00:59:59 2016 UT = Sun Oct 30 03:59:59 2016 EEST isdst=1 gmtoff=10800
/usr/share/zoneinfo/Europe/Istanbul  Sun Oct 30 01:00:00 2016 UT = Sun Oct 30 03:00:00 2016 EET isdst=0 gmtoff=7200

(In the case of no update) To prevent this situation from becoming crisis, we decide to have a backup plan which is setting timezone of our servers to fixed GMT+3; but we face with a strange behaviour when fixed GMT+3 is set.

Let's see what are the local time and UTC time on our server before we make any change on timezone.

# date
Wed Sep 21 11:13:11 EEST 2016
# date -u
Wed Sep 21 08:13:15 UTC 2016

We set timezone to fixed GMT+3 as follow:

# rm -f /etc/localtime
# ln -s /usr/share/zoneinfo/Etc/GMT+3 /etc/localtime

Let's see what are the local time and UTC time on our server after change. GMT+3 time is 3 hours earlier than UTC where it should be 3 hours later than UTC, as seen in the output above.

# date
Wed Sep 21 05:14:24 GMT+3 2016
# date -u
Wed Sep 21 08:14:26 UTC 2016

It does not change, even if we reset the local time or UTC time.

# date -s "21 Sep 2016 11:16:00"
Wed Sep 21 11:16:00 GMT+3 2016
# date
Wed Sep 21 11:16:02 GMT+3 2016
# date -u
Wed Sep 21 14:16:05 UTC 2016

# date -u -s "21 Sep 2016 11:16:00"
Wed Sep 21 11:16:00 UTC 2016
# date
Wed Sep 21 08:16:01 GMT+3 2016
# date -u
Wed Sep 21 11:16:02 UTC 2016

Why does the offset appear to be backwards?

Best Answer

Update #1: Timezone database update is released recently for several operating systems under their official repositories. The version tzdata2016g includes settings for the mentioned change.

At some point, this question is the duplicate of question asked on superuser.com.

Crystal clear answer is

"Zones like Etc/GMT+6 are intentionally reversed for backwards compatibility with POSIX standards"

But I believe that it should not be deleted to help people who want to disable DST changes in Linux systems.

To disable DST changes, link your /etc/localtime file to one of zoneinfo files placed under the folder /usr/share/zoneinfo/Etc/

Example command:

# ln -s /usr/share/zoneinfo/Etc/GMT+3 /etc/localtime

To choose most suitable zoneinfo file, reverse the sign of your targeted GMT.

i.e. For setting GMT+3 timezone (which is 3 hours ahead of UTC), one should use /usr/share/zoneinfo/Etc/GMT-3

Related Topic