9

I do not want my system to use daylight saving time.

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

I could not solve this problem permanently with ntp or tzdate. How do I disable daylight saving time?

4
  • Excuse my ignorance but what are daylights saving ?
    – Kiwy
    Apr 7, 2014 at 8:22
  • 1
    @Kiwy Read en.wikipedia.org/wiki/Daylight_saving_time
    – jofel
    Apr 7, 2014 at 8:30
  • @jofel thank you ^^ I really didn't know the english term for that
    – Kiwy
    Apr 7, 2014 at 8:31
  • 5
    Note that under Unix/Linux, daylight savings time is not so much used, but displayed. Any timestamp on files will be an absolute time, and timezone information is calculated when the directory is listed, so an individual program may or may not display DST. Changing the default is just that: the default (and, probably, what syslogd uses). Apr 7, 2014 at 13:18

3 Answers 3

17

There are DST-free timezone definitions provided which just define the GMT-offset, called 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
$

Just link/copy the one you need to /etc/localtime and you should be fine and DST-free:

$ ln -s /usr/share/zoneinfo/Etc/GMT-1 /etc/localtime

Edit: For non-integer offsets you would be on your own. You might build your own zone-file defining the offset you need: Put the following lines into a file:

# 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

and run

$ zic -d . <filename>

This will produce a file called Tehran-nodst in the current directory, which you can copy to /usr/share/zoneinfo/Asia and link/copy to /etc/localtime (only doing the last copy would be perfectly fine, too).

2
  • This works in general for timezone with integer offset, but as far as I have seen, there is no Etc/GMT+3:30 rule which would be needed for Asia/Tehran. (TZ=GMT+3:30 works, but cannot be used for /etc/localtime).
    – jofel
    Apr 7, 2014 at 15:26
  • 1
    Sorry, missed that Tehran has non-integer offset. Fixed the answer appropriately. Now it should be really exact. Apr 7, 2014 at 16:34
0

You need probably define your own Timezone without any DST rules. Look at the source files of the tzdata package which contains the sources of the compiled files in /usr/share/zoneinfo/.

-1

Just remove /etc/localtime (or back up it mv /etc/localtime /etc/localtime.back) make a link to your timezone like below:

ln -s /usr/share/zoneinfo/Asia/Tehran /etc/localtime
5
  • This probably does not work as the Asia/Tehran timezone uses DST rules.
    – jofel
    Apr 7, 2014 at 8:45
  • @jofel how use DST rules?
    – alireza
    Apr 7, 2014 at 9:12
  • @Charlesnakhel i tested this way before, not work.
    – alireza
    Apr 7, 2014 at 9:14
  • @alireza.m do you have a chance to restart the server (# /sbin.init 6) and after the reboot sync the hw clock (# /usr/sbin/hwclock –systohc) Apr 7, 2014 at 9:18
  • 4
    Timezone changes don't need reboots. This just does not work since Asia/Tehran defines DST. Apr 7, 2014 at 9:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .