soulriot
Posts: 1
Joined: Wed Sep 30, 2015 8:05 am

Does Raspbian automatically change time for DST?

Wed Sep 30, 2015 8:09 am

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?

User avatar
rpdom
Posts: 15046
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Does Raspbian automatically change time for DST?

Wed Sep 30, 2015 8:53 am

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.

aoakley
Posts: 66
Joined: Fri May 11, 2012 10:27 pm
Contact: Website

Re: Does Raspbian automatically change time for DST?

Wed Sep 30, 2015 3:00 pm

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!
Andrew Oakley - Cotswold Raspberry Jam, Gloucestershire - http://www.cotswoldjam.org

spl23
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 375
Joined: Fri Dec 26, 2014 11:02 am

Re: Does Raspbian automatically change time for DST?

Wed Sep 30, 2015 4:51 pm

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.

User avatar
DougieLawson
Posts: 35837
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Does Raspbian automatically change time for DST?

Wed Sep 30, 2015 6:36 pm

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.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Does Raspbian automatically change time for DST?

Wed Sep 30, 2015 8:36 pm

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.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

User avatar
DougieLawson
Posts: 35837
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Does Raspbian automatically change time for DST?

Wed Sep 30, 2015 8:40 pm

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.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Return to “Raspbian”