Server Daylight Saving Time Configuration

From MyWiki

Jump to: navigation, search

Checking the Current DST Rule

In 2007, the dates for when DST begins and ends changed. The daylight savings rules on the servers need to change to reflect this. You can check this by running the following command as root (zdump is in /usr/sbin/ in case it's not in your path):

zdump -v /etc/localtime | grep 2007

You should see something like this:

/etc/localtime  Sun Mar 11 06:59:59 2007 UTC = Sun Mar 11 01:59:59 2007 EST isdst=0 gmtoff=-18000
/etc/localtime  Sun Mar 11 07:00:00 2007 UTC = Sun Mar 11 03:00:00 2007 EDT isdst=1 gmtoff=-14400
/etc/localtime  Sun Nov  4 05:59:59 2007 UTC = Sun Nov  4 01:59:59 2007 EDT isdst=1 gmtoff=-14400
/etc/localtime  Sun Nov  4 06:00:00 2007 UTC = Sun Nov  4 01:00:00 2007 EST isdst=0 gmtoff=-18000

But notice that these are rules for the Eastern timezone.

Setting the Current DST Rule

Setting the timezone to Central can be done as follows:

ln -sf /usr/share/zoneinfo/US/Central /etc/localtime

Which should then produce the correct settings:

[root@viper ~]# zdump -v /etc/localtime|grep 2007
/etc/localtime  Sun Mar 11 07:59:59 2007 UTC = Sun Mar 11 01:59:59 2007 CST isdst=0 gmtoff=-21600
/etc/localtime  Sun Mar 11 08:00:00 2007 UTC = Sun Mar 11 03:00:00 2007 CDT isdst=1 gmtoff=-18000
/etc/localtime  Sun Nov  4 06:59:59 2007 UTC = Sun Nov  4 01:59:59 2007 CDT isdst=1 gmtoff=-18000
/etc/localtime  Sun Nov  4 07:00:00 2007 UTC = Sun Nov  4 01:00:00 2007 CST isdst=0 gmtoff=-21600

Alternatively, you can run cp -f /usr/share/zoneinfo/US/Central /etc/localtime which seems to also cause you to end up in the Central TZ. I'm not sure if there are advantages of copying the file rather than creating a link. On the surface, it seems like the link approach is better.

Problem on a FC4 Server

One of our FC4 machines produced this output:

[root@viper ~]# zdump -v /etc/localtime|grep 2007
/etc/localtime  Sun Apr  1 07:59:59 2007 UTC = Sun Apr  1 01:59:59 2007 CST isdst=0 gmtoff=-21600
/etc/localtime  Sun Apr  1 08:00:00 2007 UTC = Sun Apr  1 03:00:00 2007 CDT isdst=1 gmtoff=-18000
/etc/localtime  Sun Oct 28 06:59:59 2007 UTC = Sun Oct 28 01:59:59 2007 CDT isdst=1 gmtoff=-18000
/etc/localtime  Sun Oct 28 07:00:00 2007 UTC = Sun Oct 28 01:00:00 2007 CST isdst=0 gmtoff=-21600

This is wrong.

Note that /etc/localtime is provided by RPM package glibc.

[root@viper etc]# rpm -qa|grep glibc
glibc-2.3.6-3
glibc-kernheaders-2.4-9.1.94
glibc-common-2.3.6-3
glibc-headers-2.3.6-3
glibc-devel-2.3.6-3

Package glibc appeared to be current.

A quick look at the directory listing for /etc showed:

[root@viper etc]# cd /etc
[root@viper etc]# ls -la|grep localtime
-rw-r--r--   1 root root    1279 Aug  2  2005 localtime
-rw-r--r--   1 root root    1267 Mar 14  2006 localtime.rpmnew

This is interesting. Renaming these files to make "rpmnew" the current one yields:

[root@viper etc]# mv localtime localtime.orig
[root@viper etc]# mv localtime.rpmnew localtime
[root@viper etc]# ls -la|grep localtime
-rw-r--r--   1 root root    1267 Mar 14  2006 localtime
-rw-r--r--   1 root root    1279 Aug  2  2005 localtime.orig

But in the end, I renamed both of these "away" and created a soft link as described above in Setting the Current DST Rule.

Personal tools