[issue7229] Manual entry for time.daylight can be misleading
anatoly techtonik
report at bugs.python.org
Sat Jun 5 19:24:03 CEST 2010
anatoly techtonik <techtonik at gmail.com> added the comment:
It is too hard to track this issue without quotes from manual. Let's bring context into discussion:
http://docs.python.org/library/time.html#time.altzone
UTC offset of the local DST timezone if one is defined. Only use this if daylight is nonzero.
http://docs.python.org/library/time.html#time.daylight
Nonzero if a DST timezone is defined.
http://docs.python.org/library/time.html#time.timezone
UTC offset of the local (non-DST) timezone
So, to answer a question "What is the current UTC offset?" you need to:
if time.daylight:
if time.altzone: # using only if defined
use time.altzone
else:
use time.timezone
else:
use time.timezone
1. Is that really works like described above?
2. Should we at least group these timezone variables?
As for offtopic UTC vs GMT - I doubt there is a way to clearly express that the offset sign of the returned values is negated in comparison with real "UTC offsets" without resorting to some king of alternative east/west scale.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7229>
_______________________________________
More information about the Python-bugs-list
mailing list