Ok, with Python 2.7, first create two objects timeusing timezones from pytz (2014.07):
from datetime import time
import pytz
t1 = time(tzinfo=pytz.timezone('UTC'))
t2 = time(tzinfo=pytz.timezone('CET'))
Carefully check that they both know:
print(t1.tzinfo, t2.tzinfo)
# (<UTC>, <DstTzInfo 'CET' CET+1:00:00 STD>)
Therefore, then we can compare them. Let me do this:
t1 == t2
Why is this happening despite the fact that they both know?
It seems like a special case for Python 2.7 objects and timewhen handling time zones with zero offset:
- Works great with Python 3.4
- If replaced
'UTC'by 'EET'- works great - If I replaced
'UTC'with 'GMT'- still failed - If replaced
timeby datetime- excellent (!)