Update RedHat 9 TimeZone Info

If you're here, you probably already know 2007 has seen some massive changes to Daylight Savings Time. So I'll skip a lot of the history and just get down to what I did to fix the problem. I will note that the real problem is this stupid Daylight Saving Time and after you're done updating your system, I hope you'll contact your Congresscritter and demand this insane time shifting scheme be abolished.

I asked my question in the usual places that I look for help with Linux questions. Unfortunately they weren't very helpful. "Your system is as updated as it can be. If you want new features get FC5." Yeah that's really helpful folks. I have a system that is stable and working why the heck would I upgrade to a beta test for RHEL? If I could get the GIMP 2 and SeaMonkey installed on RH9, I'm sure I can get something simple fixed like the TimeZone info.

Finally after what seemed like hours googling for a way to update my RH9 for the new DST, I finally found a forum post that got me about 90% done. Here is what I suggest:

RedHat 9 timezone info is kept in /usr/share/zoneinfo. Your current timezone info is kept in /etc/localtime I use the RedHat gui for setting the date and time (/usr/bin/redhat-config-date).

First you want to make sure you really need to do this. So on the command line do this:

/usr/sbin/zdump -v /etc/localtime | grep 2007

If it is correct, you should see (note I'm in the Eastern Time Zone in the US, so what is correct for you may be different):

/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

In my case I saw:

/etc/localtime  Sun Apr  1 06:59:59 2007 UTC = Sun Apr  1 01:59:59 2007 EST isdst=0 gmtoff=-18000
/etc/localtime  Sun Apr  1 07:00:00 2007 UTC = Sun Apr  1 03:00:00 2007 EDT isdst=1 gmtoff=-14400
/etc/localtime  Sun Oct 28 05:59:59 2007 UTC = Sun Oct 28 01:59:59 2007 EDT isdst=1 gmtoff=-14400
/etc/localtime  Sun Oct 28 06:00:00 2007 UTC = Sun Oct 28 01:00:00 2007 EST isdst=0 gmtoff=-18000

You may also want to test the file in /usr/share/zoneinfo to see if it is correct. When I did that on /usr/share/zoneinfo/America/New_York I saw the same problem that /etc/localtime showed.

So next is to backup the /usr/share/zoneinfo directory. It's small so all I did was:

cp -r /usr/share/zoneinfo /usr/share/zoneinfo.old

The most useful thing I found on google were two random forum posts linking to http://www.twinsun.com/tz/tz-link.htm

Based on that page and the forum posts here's what I did:

mkdir /tmp/timezone
cd /tmp/timezone
wget 'ftp://elsie.nci.nih.gov/pub/tz*.tar.gz'
gzip -dc tzcode*.tar.gz | tar -xf -
gzip -dc tzdata*.tar.gz | tar -xf -

Easy enough, but now that new info has to be compiled and inserted into /usr/share/zoneinfo.

/usr/sbin/zic -d /tmp/timezone northamerica

This created some directories and useful files. Make sure the files are correct:

/usr/sbin/zdump -v /tmp/timezone/EST5EDT | grep 2007
/usr/sbin/zdump -v /tmp/timezone/America/New_York | grep 2007

You should get the output I described above. If you don't that problem is left as an exercise for the reader.

cp /tmp/timzone/EST5EDT /usr/share/zoneinfo
cp /tmp/timezone/America/New_York /usr/share/zoneinfo/America/

Now at this point I ran:

/usr/bin/redhat-config-date
which refreshed the info in /etc/localtime from my new files.

I think everything should be happy at this point. If not we'll be panicking on Mar 11. Also I'm not sure if RH uses the files in /usr/share/zoneinfo for anything other than setting the local timezone. If it uses them to calculate times when dealing with a timestamp from another zone, you may want to update all of the files just to be safe.