Commit a974e9d1 authored by Volker Krause's avatar Volker Krause
Browse files

Improve the Python timezone equivalence check

This is still not as precise as we can do it with access to the transitions
in QTimeZone, but at least this fixes the Asia/Amman vs Asia/Jerusalem
issue. Those zones just differ by 5 days in their DST transition time,
which wasn't caught by the previous check.
parent b28767a0
......@@ -219,7 +219,8 @@ namespace KnowledgeDb {
try:
# hacky tz comparison, lacking access to the rules for comparing actual DST transition times
dt = datetime.datetime.today().toordinal()
return all(lhs.utcoffset(datetime.datetime.fromordinal(dt + 30*x)) == rhs.utcoffset(datetime.datetime.fromordinal(dt + 30*x)) for x in range(0, 11))
return all(lhs.utcoffset(datetime.datetime.fromordinal(dt + 30*x)) == rhs.utcoffset(datetime.datetime.fromordinal(dt + 30*x))
and lhs.tzname(datetime.datetime.fromordinal(dt + 30*x)) == rhs.tzname(datetime.datetime.fromordinal(dt + 30*x)) for x in range(0, 11))
except:
return False
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment