Message234907
I agree that time.timezone, time.altzone is not enough in the general
case. Because UTC offset may be different at different dates for
reasons unrelated to DST transitions therefore any solution that
doesn't take into account a given date/time into account will fail.
*Nothing* works in the general case. Nothing.
But it doesn't mean that the current behaviour of time.timezone
can't be improved for this particular use-case:
lt = time.localtime() # in a short-lived script
assertEqual(lt.tm_gmtoff, -[time.timezone, time.altzone][lt.tm_isdst])
The test checks values for the current time (time.localtime()).
It should work in *most* cases if time.timezone/altzone have correct
values at import time.
Perhaps synchronizing time.timezone with C timezone variable as I've
mentioned before http://bugs.python.org/issue22798 may fix this issue
too. |
|
Date |
User |
Action |
Args |
2015-01-28 18:55:49 | akira | set | recipients:
+ akira, belopolsky |
2015-01-28 18:55:49 | akira | set | messageid: <1422471349.39.0.525165398338.issue22799@psf.upfronthosting.co.za> |
2015-01-28 18:55:49 | akira | link | issue22799 messages |
2015-01-28 18:55:49 | akira | create | |
|