Message107153
| Author |
techtonik |
| Recipients |
belopolsky, brian.curtin, docs@python, georg.brandl, napik, techtonik |
| Date |
2010年06月05日.17:24:00 |
| SpamBayes Score |
0.15392722 |
| Marked as misclassified |
No |
| Message-id |
<1275758643.04.0.779704816395.issue7229@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|