Differences between revisions 3 and 4
Revision 3 as of 2006-02-07 04:43:52
Size: 3656
Editor: JamesCameron
Comment:
Revision 4 as of 2006-02-09 03:51:46
Size: 4380
Editor: JamesCameron
Comment:
Deletions are marked like this. Additions are marked like this.
Line 70: Line 70:
= Testing =

While it isn't necessary to test since the `zdump` program above checks for discontinuities, it is possible to change your system's time so as to demonstrate the fix is good. There are side-effects of changing the time, such as distortion of file dates, or interoperability problems with other systems nearby, so it's only a good idea on a test system.

To do the test, use the `date --utc` command to change the time to, say, half a minute before the first discontinuity identified by `zdump`, then use the `date` command to show the local time, over a minute. For example:

{{{
# date --utc 040115592006.30 ; date ; sleep 20 ; date
Sun Apr 2 02:59:50 EST 2006
Sun Apr 2 02:00:10 EST 2006
}}}

Sometimes you need to change the timezone files to cope with changes to your local legal environment, such as in Australia when a state government decides to shift the start or end of daylight savings.

Debian includes timezone files in /usr/share/zoneinfo as part of the libc6 package. These files are updated eventually.

To make a change ahead of the change being made by the Debian project, follow this process:

  • run zdump to make sure the change is needed,

  • obtain an updated timezone source file, by download or patch,
  • run zic to make the change,

  • run zdump again to make sure the change is effective.

More detail below, using Sydney Australia as the example. Substitute the timezone name and the file name for your local environment.

Check If Needed

The zdump program dumps the timezone table. Use it to check the dates for the daylight savings change. For example this system has old Australian rules, showing a change from daylight saving on 26th March:

# zdump -c 2007 -v Australia/Sydney|grep 2006
Australia/Sydney  Sat Mar 25 15:59:59 2006 UTC = Sun Mar 26 02:59:59 2006 EST isdst=1 gmtoff=39600
Australia/Sydney  Sat Mar 25 16:00:00 2006 UTC = Sun Mar 26 02:00:00 2006 EST isdst=0 gmtoff=36000
Australia/Sydney  Sat Oct 28 15:59:59 2006 UTC = Sun Oct 29 01:59:59 2006 EST isdst=0 gmtoff=36000
Australia/Sydney  Sat Oct 28 16:00:00 2006 UTC = Sun Oct 29 03:00:00 2006 EST isdst=1 gmtoff=39600

Get Timezone File

Obtain a copy of the australasia timezone file from either the libc6 sources or from the upstream site. If you are using the file from the source package without the change, then change the file adding the new lines for 2006. For example these lines are in the corrected file:

...
Rule    AN      2001    max     -       Oct     lastSun 2:00s   1:00    -
Rule    AN      2006    only    -       Apr     Sun>=1  2:00s   0       -
Rule    AN      2007    max     -       Mar     lastSun 2:00s   0       -
...

To get the australasia file from the libc6 sources, configure your sources.list with deb-src lines for your current distribution version, fetch the source, unpack it, and then edit the file. For example on a system tracking Sarge (version numbers may vary):

# apt-get install dpkg-dev
# apt-get source libc6
# cd glibc-2.3.2.ds1
# . prep.sh
# cp glibc-2.3.2/timezone/australasia /root
# cd /root
# vi australasia

Change

The zic program changes the timezone table. Give it the name of the australasia source file you changed. For example:

/usr/sbin/zic australasia

Verify

Use the zdump program again to confirm the change. For example this system has the change properly applied, showing a change from daylight saving on 2nd April:

# zdump -c 2007 -v Australia/Sydney|grep 2006
Australia/Sydney  Sat Apr  1 15:59:59 2006 UTC = Sun Apr  2 02:59:59 2006 EST isdst=1 gmtoff=39600
Australia/Sydney  Sat Apr  1 16:00:00 2006 UTC = Sun Apr  2 02:00:00 2006 EST isdst=0 gmtoff=36000
Australia/Sydney  Sat Oct 28 15:59:59 2006 UTC = Sun Oct 29 01:59:59 2006 EST isdst=0 gmtoff=36000
Australia/Sydney  Sat Oct 28 16:00:00 2006 UTC = Sun Oct 29 03:00:00 2006 EST isdst=1 gmtoff=39600

Testing

While it isn't necessary to test since the zdump program above checks for discontinuities, it is possible to change your system's time so as to demonstrate the fix is good. There are side-effects of changing the time, such as distortion of file dates, or interoperability problems with other systems nearby, so it's only a good idea on a test system.

To do the test, use the date --utc command to change the time to, say, half a minute before the first discontinuity identified by zdump, then use the date command to show the local time, over a minute. For example:

# date --utc 040115592006.30 ; date ; sleep 20 ; date
Sun Apr  2 02:59:50 EST 2006
Sun Apr  2 02:00:10 EST 2006

References