Changing daylight savings time in Linux

Here's how to fix your timezone files in Linux in case some politician with nothing better to do changes the dates for daylight savings time (DST). You can't just reset your clock, because it will mess up other computers that get their time from you.

  1. Download timezone files from ftp://elsie.nci.nih.gov/pub/. This consists of two files:
    tzcode2007c.tar.gz  
    tzdata2007c.tar.gz
    
    Put them in their own directory, because when they're extracted they don't create a directory of their own.
  2. Untar the files and make them read-write.
    tar -xzvf tzcode2007c.tar.gz  
    tar -xzvf tzdata2007c.tar.gz
    chmod a+rw *
    
  3. Edit Makefile and change the install directory ("TOPDIR") to /usr/share
  4. Compile and install
    make
    make install 
    
  5. Set the timezone (in this case, to Eastern Standard Time)
    zic -l /usr/share/etc/
    zoneinfo/America/New_York
    
    Alternatively
    zic -d zoneinfo northamerica
    cd zoneinfo
    cp -r * /usr/share/zoneinfo/
  6. Reset your clock if necessary (using 'date' or '/usr/sbin/netdate').
  7. Mark down on your calendar to vote the guy that changed the date out of office.

Trivia

  1. Check the dates that your system uses for DST by examining /etc/localtime.
    zdump -v /etc/localtime
  2. New timezone files can be created in a text editor and then converted to the proper format with zic. See man zic for details.

Back