[issue22930] Value of time.timezone is sometimes wrong

2014-11-24 Thread Dmitry Shachnev

New submission from Dmitry Shachnev:

Here, on Linux, I get:

$ python3 -c import time; print(time.timezone)
-14400

… which means I am in UTC+4. However, Russia recently (in October) switched 
time, and moved from UTC+4 to UTC+3 timezone (my tzdata is up-to-date), so this 
reported value is wrong.

The relevant code in timemodule.c looks like (simplified):

  #define YEAR ((time_t)((365 * 24 + 6) * 3600))
  time_t t = (time((time_t *)0) / YEAR) * YEAR;
  struct tm *p = localtime(t);
  janzone = -p-tm_gmtoff;
  PyModule_AddIntConstant(m, timezone, janzone);

The value of t is the *January 1st* of current year, i.e. 2014-01-01 currently. 
But the timezone of a country in the year beginning may be different from its 
timezone in the year end, which is the case for me.

This bug will be relevant for Russia until the end of 2014, but may be still 
relevant for other countries that wish to change their timezone.

--
components: Extension Modules
messages: 231597
nosy: mitya57
priority: normal
severity: normal
status: open
title: Value of time.timezone is sometimes wrong
type: behavior
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22930
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22930] Value of time.timezone is sometimes wrong

2014-11-24 Thread R. David Murray

R. David Murray added the comment:

This is a duplicate of issue 22752.

--
nosy: +r.david.murray
resolution:  - duplicate
stage:  - resolved
status: open - closed
superseder:  - incorrect time.timezone value

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22930
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com