Greg ([info]g3) wrote in [info]linux,
@ 2007-02-08 15:31:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Current mood:geeky

Timezone update
Don't know if this was mentioned in the past about the changes to daylight savings time (DST) that takes effect this year, so I thought I'd be kind and share how to do this by hand. Just in case anyone here has a unsupported system, or their version of Linux has reached it's EOL.

Most of my personal boxes and a majority where I work have patches available, but a couple I use do not. My example was done on a SUN Ultra2 running Debian "Woody" 3.0 (running 3.0 being a relative term, as I've since upgraded the kernel and several other packages manually), but this should work on just about any Linux setup. I more or less followed this guide to do the updates.

The old timezone database had these as the old entries for when DST would kick-in. Note that April 1st is listed as the start and October 28th is the end. The new change to DST should read March 11th and November 4th respectively:

user@host:~> /usr/bin/zdump -v /usr/share/zoneinfo/US/Central |grep 2007
/usr/share/zoneinfo/US/Central  Sun Apr  1 07:59:59 2007 UTC = Sun Apr  1 01:59:59 2007 CST isdst=0 gmtoff=-21600
/usr/share/zoneinfo/US/Central  Sun Apr  1 08:00:00 2007 UTC = Sun Apr  1 03:00:00 2007 CDT isdst=1 gmtoff=-18000
/usr/share/zoneinfo/US/Central  Sun Oct 28 06:59:59 2007 UTC = Sun Oct 28 01:59:59 2007 CDT isdst=1 gmtoff=-18000
/usr/share/zoneinfo/US/Central  Sun Oct 28 07:00:00 2007 UTC = Sun Oct 28 01:00:00 2007 CST isdst=0 gmtoff=-21600

  • 1) Get the updated timezone data. This file is what I used.
  • 2) Unpack the GZip TAR archive. You will get several timezone files. The only one I was interested in was for North America (northamerica), so I more or less ignored the rest. Use whatever zone files apply to you.
  • 3) Compile the timezone source file(s) with zic
           root@host:~> /usr/bin/zic /path/to/zonefile

  • 4) No command-line arguments will put it in /usr/share/zoneinfo/America, but you can specify a different location by the -d switch.
  • 5) Change the /etc/localtime alias. Now on my old config, the correct timezone database was located in /usr/share/zoneinfo/US/Central. The new one is located in /usr/share/zoneinfo/America/Chicago. Just select the nearest city in which you live with the correct timezone.1
           root@host:~> ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime

Once this is done your timezone should reflect the correct dates and times:
user@host:~> /usr/bin/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

1: I also noticed that /usr/share/zoneinfo/CST6CDT was new and appears to contain the same file information as /usr/share/zoneinfo/America/Chicago, so one could probably just use that file.



(Post a new comment)


[info]ravan
2007-02-08 10:18 pm UTC (link)
Thank You. This saved me from having to go and look for it...

(Reply to this)


[info]hwc
2007-02-09 04:39 pm UTC (link)
Why can't we all just use UTC+0 all the time?

(Reply to this) (Thread)


[info]g3
2007-02-09 09:48 pm UTC (link)
Because waking up for work at 1pm would just mess with my head.

(Reply to this) (Parent)


[info]in0p
2007-02-11 06:10 pm UTC (link)
it works for pilots ^^

(Reply to this) (Parent)


Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…