This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python's timezon handling: daylight saving option
Type: enhancement Stage:
Components: Library (Lib) Versions: 3rd party
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: ajaksu2, earendili510, loewis
Priority: normal Keywords:

Created on 2009-01-08 15:03 by earendili510, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (9)
msg79415 - (view) Author: Pablo Castagnino (earendili510) Date: 2009-01-08 15:03
Something in python's timezone handling needs to be
updated. Python does not take into account 'daylight saving' clock time
changes.

The thing is my clock time is correct. If you
ask anyone here for the time, they will tell you it's X. However, Python
believes (correct) current time is X + 1 hour. In fact, this is the case
most of the time, but because of 'daylight saving' measures, official
time has been changed. So, without a doubt, this needs to be fixed.

A solution could be adding the possibility to set a 'daylight saving'
option which helps dealing with this. So, if I set this option to 3600
secs, then Python could +/- this remainder to the, let's call it,
'expected current time' according to the timezone.
msg79437 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-01-08 20:44
Can you provide more details? What is the specific Python source code
that you are running, what operating system you run it one, what time
zone has been configured into your system, what output do you get, what
output do you expect?

Python definitely does support daylight saving time already just fine.
msg79452 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-01-09 02:24
Pablo,
As Martin says, Python does support DST changes. But it might not have
enough information about your timezone. If that's the case, take a look
at these links to see how adding (up-to-date) support for your tz can be
achieved:

Building a tzinfo class ->
http://svn.python.org/view/python/trunk/Doc/includes/tzinfo-examples.py?rev=62214&view=auto

Using the TZ environment variable ->
http://docs.python.org/dev/library/time.html#time.tzset

HTH, Daniel
msg79476 - (view) Author: Pablo Castagnino (earendili510) Date: 2009-01-09 16:14
Ok, first of all I want to say I'm no Python programmer/developer.
However, I recently posted a 'bug' for a Linux/Windows program I'm using
very much which is based in Python. The program is called Anki and it's
designed to help you remember facts (such as words and phrases in a
foreign language) as easily, quickly and efficiently as possible.

Here, http://code.google.com/p/anki/issues/detail?id=613, you'll find my
explanation of the 'bug'.

Briefly, I live in Argentina and the current administration has changed
current time because of 'daylight saving'. However, when syncing my
decks (which store all my cards) with Anki's server, it tells me my
current time is wrong and that I need to change it. In fact, it's not MY
clock which is wrong, but Anki's. So, I posted this bug and the
developer, as you can see, told me that: it's not really anki's job - a
setting to shift the clock would need changes all throughout the code.
probably something in python's timezone handling needs to be updated.
could you post about the daylight savings issue on the python mailing
list and see what they say? So, this is what I'm doing. 

Right now I will notify the developer of this program that, actually,
Python already handles 'time saving'.

Thanks for your help. Any other comments/ideas would be greatly appreciated.
msg79496 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-01-09 19:55
For Windows (what version are you using?), you need to install
Microsoft's time zone patches, e.g. the one described in

http://support.microsoft.com/kb/951072

Depending on the exact version of Windows that you use, and depending on
whether or not you run Windows update regularly, your system may or may
not have that patch installed.

Same for Linux, except that I can't point to a single update. What
precise Linux distribution are you using? Have you installed their time
zone updates?
msg79642 - (view) Author: Pablo Castagnino (earendili510) Date: 2009-01-12 01:25
the last post on that link is the point - python supports daylight
savings, but if
your city recently started using daylight savings, and didn't before,
then either
python or linux needs to be updated to know that.

I'm using Ubuntu Intrepid Ibex.
msg79646 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-01-12 05:09
For Ubuntu Intrepid, you need the package tzdata 2008h-2ubuntu1
installed; it contains a correction for the Argentinian DST definition.
Intrepid itself only shipped with 2008h-2.

Closing this as third-party.
msg79713 - (view) Author: Pablo Castagnino (earendili510) Date: 2009-01-13 01:55
Ok, everything seems to be working now in Ubuntu. However, I can't get
it work in WIN XP (at work). :(

Thanks for all your help!
msg79746 - (view) Author: Pablo Castagnino (earendili510) Date: 2009-01-13 15:46
Ok. I installed the WIN XP patch loewis talked about...and now
everything works smoothly in Windows too. Thanks!
History
Date User Action Args
2022-04-11 14:56:43adminsetgithub: 49131
2009-01-13 15:46:31earendili510setmessages: + msg79746
2009-01-13 01:55:02earendili510setmessages: + msg79713
2009-01-12 05:09:42loewissetstatus: open -> closed
resolution: works for me
messages: + msg79646
versions: + 3rd party
2009-01-12 01:26:00earendili510setmessages: + msg79642
2009-01-09 19:55:07loewissetmessages: + msg79496
2009-01-09 16:14:48earendili510setmessages: + msg79476
2009-01-09 02:24:35ajaksu2setnosy: + ajaksu2
messages: + msg79452
2009-01-08 20:44:35loewissetnosy: + loewis
messages: + msg79437
2009-01-08 15:03:00earendili510create