Page 1 of 1

Does Raspbian automatically change time for DST?

Posted: Wed Sep 30, 2015 8:09 am
by soulriot
Hi
I'm running an installation with Raspbian which will be installed for several months. During this time, the clocks will go back by one hour (Daylight saving time in the Uk). I am running time from an rtc (eg. I will have no internet access on the RPI), and was wondering if anybody knows whether it will automatically compensate for daylight saving time?

Re: Does Raspbian automatically change time for DST?

Posted: Wed Sep 30, 2015 8:53 am
by rpdom
Yes.

The system clock in Linux is always set to GMT* (CUT). The 'date' command and everything else just display it in your local time based on the timezone settings. Those settings also include any DST settings and will change the displayed time to match. You don't need to do anything.

Try these commands to see what happens to the displayed time (my timezone is GMT/BST)

Code: Select all

[email protected] ~ $ date -d '2015-06-30 12:00 GMT'
Tue Jun 30 13:00:00 BST 2015
[email protected] ~ $ date -d '2015-12-30 12:00 GMT'
Wed Dec 30 12:00:00 GMT 2015
Note that I specify GMT for my example dates/times and it is displayed as local time for that time of year.

*It is possible to have an internal clock set to local time. This option was to allow for dual-boot with certain operating systems that required the clock to be set to local time.

Re: Does Raspbian automatically change time for DST?

Posted: Wed Sep 30, 2015 3:00 pm
by aoakley
As noted above, the internal clock is set to use UTC (which is mostly the same as GMT), and then the operating system is aware of what timezone it is in, and shows the correct time for that timezone, based on an offset from UTC.

You can check and configure which timezone your system is set to, by going to a terminal session and doing:

Code: Select all

sudo dpkg-reconfigure tzdata
For example, the UK timezone is set as Europe - London .

Note that you have to use a geographic timezone in order to get the appropriate Daylight Savings Time adjustments. So right now, in the UK in summer, it is no good just specifying GMT+1 , because that will stay as GMT+1 all year round. You need to specify Europe - London in order for the machine to automatically switch between British Summer TIme and GMT.

Sometimes governments change their mind about timezones. Raspbian (via Debian) gets these updates when you do apt-get dist-upgrade or similar. I recall not too long ago when some South American government changed its mind several times in six months - lots of updates!

Re: Does Raspbian automatically change time for DST?

Posted: Wed Sep 30, 2015 4:51 pm
by spl23
I should add here that anyone using the new Jessie image now has a nice GUI for setting timezone - in the Raspberry Pi Configuration application, click the Set Timezone button on the Localisation tab and select your zone from the dropdowns.

Re: Does Raspbian automatically change time for DST?

Posted: Wed Sep 30, 2015 6:36 pm
by DougieLawson
If you set the timezone to your local zone and ensure the date/time is set to local time then everything will just work on 25th Oct (Europe) or 1st Nov (North America) when daylight saving ends. It really is 100% automatic.

The common error is to have the timezone set to GMT/UTC but the clock set to your local date/time. That will break when the clocks change.

The alternative is to move to South Africa, Western Australia, Arizona, Alaska or one of the other territories that doesn't bother with the entirely pointless act of changing the local clock.

Re: Does Raspbian automatically change time for DST?

Posted: Wed Sep 30, 2015 8:36 pm
by Joe Schmoe
DougieLawson wrote: The alternative is to move to South Africa, Western Australia, Arizona, Alaska or one of the other territories that doesn't bother with the entirely pointless act of changing the local clock.
I agree with the sentiment. DST is one of the stupidest things man has ever invented. Of course, I think that time zones themselves are also unnecessary. Everybody (not just Unix systems) should be on GMT/UTC.

But, FWIW, I think you want to: s/Alaska/Hawaii/p

According to: https://en.wikipedia.org/wiki/Alaska_Time_Zone
they do observe DST.

Re: Does Raspbian automatically change time for DST?

Posted: Wed Sep 30, 2015 8:40 pm
by DougieLawson
Joe Schmoe wrote: But, FWIW, I think you want to: s/Alaska/Hawaii/p
I knew it was one of those states that isn't joined to the main 48.

I'll join your campaign to abolish timezones.
https://www.youtube.com/watch?v=-5wpm-gesOY

At least they aren't as horrid as national languages and code pages.