To fix timezone on latest version of debian:

# dpkg-reconfigure tzdata

That will bring up a menu to fix your timezone, I picked America, Pacific (not Pacific-New, no clue what that is, picking Pacific works for me and its timezone DST timechanges match that of timeanddate.com)

To check how it fixed it (if its correct you will see files are identical):

$ diff -s /etc/localtime /usr/share/zoneinfo/`cat /etc/timezone`
Files /etc/localtime and /usr/share/zoneinfo/America/New_York are identical

Daylight Saving Time

Then to check timezone info like the GMT setting and also when the time shifts (like for daylight saving time):

“Spring Forward, Fall back” a famous everyday line we hear for Daylight Saving Time, here is how to analyze it:

In Spring we move the clock forward 1 hour enabling Daylight Saving Time (giving us Summer Time, more light in the day and later sunset)

In the Fall we move the clock back 1 hour disabling Daylight Saving Time (give us normal time). The states and countries that dont follow Daylight Saving Time, are always in this time:

With linux to check when these Time changes occur:

From now on I will refer to Daylight Saving Time as DST.

We will use zdump, which comes with almost every system.

# dpkg -S `which zdump`
libc-bin: /usr/bin/zdump

Thats the package it comes with libc-bin, so if your missing it:

# apt-get update;
# apt-get install libc-bin

Run zdump like this

# zdump -c END_YEAR -v TIMEZONE_NAME

zdump will dump every timezone DST change from the beginning of time computers begin recording time at (which is usually 18xx) to the END_YEAR. So put the END_YEAR value ahead of the current year (Current year right now is 2014 so I will choose 2015 for END_YEAR). The TIMEZONE_NAME should go in as your /etc/timezone says it (also you can give the full path to the timezone file like so I can put US/Pacific or /usr/share/zoneinfo/US/Pacific).

# cat /etc/timezone
US/Pacific

NOTE: its the relative location of the timezone you want from the folder /usr/share/zoneinfo

To see all available timezone:

# cd /usr/share/zoneinfo
# find -type f
EXAMPLE OUTPUT (only seeing a part of it, thus you see the snips):
..snip..
./Canada/Newfoundland
./Canada/Pacific
./Canada/Atlantic
./Canada/Yukon
./Canada/Mountain
..snip..

or:

# find /usr/share/zoneinfo -type f
EXAMPLE OUTPUT (only seeing a part of it, thus you see the snips):
..snip..
/usr/share/zoneinfo/Asia/Taipei
/usr/share/zoneinfo/Asia/Hebron
/usr/share/zoneinfo/Asia/Bishkek
/usr/share/zoneinfo/Asia/Vladivostok
/usr/share/zoneinfo/Asia/Dhaka
/usr/share/zoneinfo/Asia/Vientiane
..snip..

NOTE: not all files in /usr/share/zoneinfo are legit timezone files, you can test with zdump, if they are correct timezone files you will have lots of output, if they are incorrect your will just see NULL output. Note correct timezone files also have some NULL output (but lots of data output as well)

To see every timezone change (all of the DST changes for US/Pacific since the beginning of time to 2015):

# zdump -c 2015 -v US/Pacific
or
# zdump -c 2015 -v /usr/share/zoneinfo/US/Pacific

or – to use your timezone without looking up its correct location syntax – we will use `cat /etc/timezone` command substitution, of course $(cat /etc/timezone) will work as well – both will put after the -v the current timezone your system is configured as (if its configured wrong look at the top of the article and run  dpkg-reconfigure tzdata):

# zdump -c 2015 -v `cat /etc/timezone`
/usr/share/zoneinfo/US/Pacific Sun Nov 1 08:59:59 2015 UTC = Sun Nov 1 01:59:59 2015 PDT isdst=1 gmtoff=-25200
/usr/share/zoneinfo/US/Pacific Sun Nov 1 09:00:00 2015 UTC = Sun Nov 1 01:00:00 2015 PST isdst=0 gmtoff=-28800
/usr/share/zoneinfo/US/Pacific Sun Mar 13 09:59:59 2016 UTC = Sun Mar 13 01:59:59 2016 PST isdst=0 gmtoff=-28800
/usr/share/zoneinfo/US/Pacific Sun Mar 13 10:00:00 2016 UTC = Sun Mar 13 03:00:00 2016 PDT isdst=1 gmtoff=-25200
/usr/share/zoneinfo/US/Pacific Sun Nov 6 08:59:59 2016 UTC = Sun Nov 6 01:59:59 2016 PDT isdst=1 gmtoff=-25200
/usr/share/zoneinfo/US/Pacific Sun Nov 6 09:00:00 2016 UTC = Sun Nov 6 01:00:00 2016 PST isdst=0 gmtoff=-28800

Now to see the DST changes for lets say 2014 and 2013:

# zdump -c 2015 -v `cat /etc/timezone` | egrep "2013|2014"
# zdump -c 2015 -v `cat /etc/timezone` | egrep "2013"
# zdump -c 2015 -v `cat /etc/timezone` | egrep "2012"
OR (notice no slash in the front):
# zdump -c 2015 -v US/Pacific | egrep "2013|2014"
# zdump -c 2015 -v US/Pacific | egrep "2013"
# zdump -c 2015 -v US/Pacific | egrep "2012"
OR (notice absolute path so there is a slash in the front):
# zdump -c 2015 -v /usr/share/zoneinfo/US/Pacific | egrep "2013|2014"
# zdump -c 2015 -v /usr/share/zoneinfo/US/Pacific | egrep "2013"
# zdump -c 2015 -v /usr/share/zoneinfo/US/Pacific | egrep "2012"

For another timezone. use the output of the find command to select a timezone of your choice:

# zdump -c 2015 -v Canada/East-Saskatchewan | egrep "2013|2014"
# zdump -c 2015 -v Portugal | egrep "2013"
# zdump -c 2015 -v posix/EST | egrep "2012" #<-- this will not work, not all files in /usr/share/zoneinfo are "timezone files"
OR:
# zdump -c 2015 -v /usr/share/zoneinfo/Canada/East-Saskatchewan | egrep "2013|2014"
# zdump -c 2015 -v /usr/share/zoneinfo/Portugal | egrep "2013"
# zdump -c 2015 -v /usr/share/zoneinfo/posix/EST | egrep "2012" " #<-- this will not work, not all files in /usr/share/zoneinfo are "timezone files"

Analyzing DST for US Pacific ti

Time zone changes for the year 2014

Lets analyze someout put for example for US/Pacific:
Anyhow the output for example for US/Pacific

# zdump -c 2016 -v US/Pacific | egrep "2014"
US/Pacific Sun Mar 9 09:59:59 2014 UTC = Sun Mar 9 01:59:59 2014 PST isdst=0 gmtoff=-28800 #<- before change
US/Pacific Sun Mar 9 10:00:00 2014 UTC = Sun Mar 9 03:00:00 2014 PDT isdst=1 gmtoff=-25200 #<- after/during change
US/Pacific Sun Nov 2 08:59:59 2014 UTC = Sun Nov 2 01:59:59 2014 PDT isdst=1 gmtoff=-25200
US/Pacific Sun Nov 2 09:00:00 2014 UTC = Sun Nov 2 01:00:00 2014 PST isdst=0 gmtoff=-28800

NOTE: 2 enteries per timezone change, first entry showing before the change and it tells you how long the old setting will last that day before that change, (showing you the second before the DST takes effect). The entry after that shows how the clocks will be right after the change (1 hour ahead). This shows UTC time (same as GMT time, goes thru Great Britain and part of Eastern Africa) as well to show you how it aligns with the rest of the world.

So what this says is that on March 9 2014 DST will be turned off
(isdst=0) all the way until 1:59:59 PST (localtime, UTC time is 09:59:59 march 9th), but then the second after that at 3:00:00 2014 PDT (localtime, UTC time is 10:00:00 march 9th) DST will be turned on (isdst=1).

Further interpretation shows that basically on March 9th 2014 at 2am local time Daylight Saving Time will be enabled and we will push our clocks forward until 3am, skipping the entire hour of 2:00:00 am thru 2:59:59 am.

To see it for 2014 and 2015 (Set -c to a year ahead to 2016 or else you wont see it):

# zdump -c 2016 -v US/Pacific | egrep "2014|2015"
US/Pacific Sun Mar 9 09:59:59 2014 UTC = Sun Mar 9 01:59:59 2014 PST isdst=0 gmtoff=-28800
US/Pacific Sun Mar 9 10:00:00 2014 UTC = Sun Mar 9 03:00:00 2014 PDT isdst=1 gmtoff=-25200
US/Pacific Sun Nov 2 08:59:59 2014 UTC = Sun Nov 2 01:59:59 2014 PDT isdst=1 gmtoff=-25200
US/Pacific Sun Nov 2 09:00:00 2014 UTC = Sun Nov 2 01:00:00 2014 PST isdst=0 gmtoff=-28800
US/Pacific Sun Mar 8 09:59:59 2015 UTC = Sun Mar 8 01:59:59 2015 PST isdst=0 gmtoff=-28800
US/Pacific Sun Mar 8 10:00:00 2015 UTC = Sun Mar 8 03:00:00 2015 PDT isdst=1 gmtoff=-25200
US/Pacific Sun Nov 1 08:59:59 2015 UTC = Sun Nov 1 01:59:59 2015 PDT isdst=1 gmtoff=-25200
US/Pacific Sun Nov 1 09:00:00 2015 UTC = Sun Nov 1 01:00:00 2015 PST isdst=0 gmtoff=-28800

Remember 2 lines per time change. So there is 2 changes in 2014 (one of which we talked about on March 9th 2014), and then one to cancel off the March 9th DST on November 2nd (clock move back at the same time of 2:00am, they turn back to 1am, so we get to “relive” 1:00 am to 1:59 am). On 2015 those changes occur on different dates (So that they fall on Sundays, these timezone changes always tend to fall on sundays, as to not mess with the business/work week), DST will be enabled on March 8th and Disabled on November 1st.

Leave a Reply

Your email address will not be published. Required fields are marked *