Ben Hutchings <ben.hutchings at roundpoint.com> writes: [...] > The minute digits of the time offset weren't included just for fun; > there really are zones that aren't offset by a whole number of hours. > How about this instead: > > def zone822(dst): > offs = (0, time.timezone, time.altzone)[1 + dst] > return '%s%02d%02d' % ("+-"[offs >= 0], > abs(offs) / 3600, > (abs(offs) / 60) % 60) Oops - I should have remembered that, especially since there's one of those locations offshore from me here. I also wonder now about the output when the dst flag is -1, since it's not exactly clear when that will happen. Maybe something like this would be better: def zone822(dst): offs = (time.timezone, time.timezone, time.altzone)[1 + dst] return '%+.2d%.2d' % (offs / -3600, abs(offs / 60) % 60) -- Carey Evans http://home.clear.net.nz/pages/c.evans/ "Quiet, you'll miss the humorous conclusion."
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4