Difference between revisions of "Update timezone files for earlier Daylight Savings Time"
(→See also) |
|||
Line 50: | Line 50: | ||
<references/> | <references/> | ||
==See also== | ==See also== | ||
− | *[[zdump]] | + | *[[zdump]] — time zone dumper |
− | *[[zic]] | + | *[[zic]] — time zone compiler |
[[Category:Linux Command Line Tools]] | [[Category:Linux Command Line Tools]] |
Revision as of 04:35, 7 March 2007
Because of the Energy Policy Act of 2005, beginning in 2007, the United States will begin observing Daylight saving time (DST) from the second Sunday in March until the first Sunday in November.[1]
Older Linux kernels are using the older definition of DST and the files that control this will need to be updated. Below I will show you how to do this.
- Step 1: Check that you are using the older DST definition.
To determine if your time zone has an issue, run this command:
% zdump -v /etc/localtime | grep 2007
For an example, if you are living in the "Pacific" time zone, you should get something like the following:
/etc/localtime Sun Apr 1 09:59:59 2007 UTC = Sun Apr 1 01:59:59 2007 PST isdst=0 gmtoff=-28800 /etc/localtime Sun Apr 1 10:00:00 2007 UTC = Sun Apr 1 03:00:00 2007 PDT isdst=1 gmtoff=-25200 /etc/localtime Sun Oct 28 08:59:59 2007 UTC = Sun Oct 28 01:59:59 2007 PDT isdst=1 gmtoff=-25200 /etc/localtime Sun Oct 28 09:00:00 2007 UTC = Sun Oct 28 01:00:00 2007 PST isdst=0 gmtoff=-28800
Notice that those dates do not correspond to the second Sunday in March nor the first Sunday in November. If you see this in the output, then your DST will not start (or end) on the correct day.
The time zone files are using found here:
/usr/share/zoneinfo/
and they are usually linked to the /etc/localtime
% ls -lah /etc/localtime lrw-r--r-- 1 root root 1.1K Jan 5 2006 /etc/localtime -> /usr/share/zoneinfo/America/Vancouver
- Step 2: Download the patch from here. You will need the file
tzdata2007c.tar.gz
(this may have changed since writing this).
- Step 3: Extract the contents of the archive to a local folder.
- Step 4: Since, in our example, we are interested in the files related to the "Pacific" timezone, we will only need "
northamerica
" and/or "pacificnew
". (note: Some modifications where made to theeurope
andafrica
files as well, and the last command,zic backwards
, will complain if you don't include them.) Here are the commands to run (as root):
% cd /path/to/tzdata2007c % zic europe % zic africa % zic northamerica % zic backwards
Et voilà! Now, check your results with the original command again:
zdump -v /etc/localtime | grep 2007
and you should see something like this:
/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
It's the "Mar 11" and "Nov 4" that tell us we have successfully updated our /etc/localtime
file.