【发布时间】:2013-08-17 18:43:50
【问题描述】:
正确值:
>>> pytz.timezone('Asia/Tehran').utcoffset(datetime(2013, 1, 1)).total_seconds()/3600.0
3.5
>>> pytz.timezone('Asia/Tehran').utcoffset(datetime(2013, 1, 1)).total_seconds()
12600.0
值不正确:
>>> pytz.timezone('Asia/Tehran')._utcoffset.total_seconds()/3600.0
3.433333333333333
>>> pytz.timezone('Asia/Tehran')._utcoffset.total_seconds()
12360.0
我想知道utcoffset()方法中是否使用了_utcoffset属性,为什么该方法在属性错误时起作用。
无论如何看起来像一个错误。
如果将 Asia/Tehran 替换为 Iran,则没有任何变化
>>> print pytz.VERSION
2012c
操作系统:Linux Mint 15 (Olivia)
使用 Python 2.7
【问题讨论】: