How to Check and Update Daylight Savings Time Information in Linux

If you haven’t already heard, Because of The Energy Policy Act of 2005 Daylight Savings Time in the USA will start 3 weeks earlier at 2am on the second Sunday in March and end one week later at 2am on the first Sunday in November. It’s important that you check your current settings to make sure you don’t have any issues or get your time out of sync. Even if you have your time updated via NTP, you aren’t covered. NTP operates by setting your computer time to UTC or Universal Standard Time. Your computer then calculates the correct local time according to your time zone settings.


If you are wondering if your Linux system has the updated daylight savings time settings for 2007 there is a simple command you can run to check.

(*note: Commands preceded by a “$” are run as a normal user and commands preceded by a “#” are run as root.)

Run the following command as root:

# zdump -v /etc/localtime | grep 2007

If the output looks something like below you are golden. The important part is to check that the Spring forward date is March 11th and the Fall back date is November 4th.

/etc/localtime Sun Mar 11 09:59:59 2007 UTC = Sun Mar 11 01:59:59 2007 PST isdst=0 gmtoff=-28800
/etc/localtime Sun Mar 11 10:00:00 2007 UTC = Sun Mar 11 03:00:00 2007 PDT isdst=1 gmtoff=-25200
/etc/localtime Sun Nov 4 08:59:59 2007 UTC = Sun Nov 4 01:59:59 2007 PDT isdst=1 gmtoff=-25200
/etc/localtime Sun Nov 4 09:00:00 2007 UTC = Sun Nov 4 01:00:00 2007 PST isdst=0 gmtoff=-28800

If that’s not the case you can manually update your time zone files with the following technique:

$ su

# cd /tmp

# ftp elsie.nci.nih.gov

login user: anonymous
password: youremail@yourdomain.com

# cd pub

# ls

# get tzdata2007c.tar.gz

# quit

# tar xzvf tzdata2007c.tar.gz

# cp /etc/localtime /etc/localtime.OLD

# rm /etc/localtime

# zic northamerica

For the following command, make sure you use the file specific to your time zone. My example uses the US Pacific Standard Time.

# ln -s /usr/share/zoneinfo/US/Pacific /etc/localtime

# zdump -v /etc/localtime | grep 2007

Now you should see the updated time zone information.

Tags: , , , , , ,

5 Comments so far »

  1. Fred Y. said,

    Wrote on March 25, 2007 @ 3:27 am

    Thanks so much for this great step by step fix. I was actually noticing this problem on my server and thanks to you, I was able to fix this myself rather easily :) Saved me some money from having my webhost technicians do it for me

  2. Mark said,

    Wrote on March 27, 2007 @ 6:31 am

    @ Fred: That’s good news Fred, I’m glad it was helpful.

  3. shivakumar said,

    Wrote on January 31, 2008 @ 11:00 pm

    Thank you very much.

    These simple steps help me a lot for DST enabling in my machine…

  4. Paul B said,

    Wrote on March 23, 2008 @ 7:07 am

    Thanks for the concise step by step, it worked fine when a few changes where accounted for. The file name has changed to (as of 032208) tzdata2008a.tar.gz. This new file gives a directory called ‘America’ instead of ‘US’ when zic northamerica is run. I ended up with ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime for the symlink. Hopefully this note can save some head scratching.

    Paul

  5. Hector said,

    Wrote on March 26, 2008 @ 5:57 am

    Here’s the thing, I do the update as indicated above and the everything is pointing now for a DST that started on March 9, but for some weird reason now my server’s time is ahead 1hr. Any advice ?

Comment RSS · TrackBack URI

Leave a Comment

Name: (Required)

E-mail: (Required)

Website:

Comment: