Edgewall Software

Changes between Initial Version and Version 1 of Ticket #12617, comment 6


Ignore:
Timestamp:
Mar 7, 2017, 2:50:20 PM (7 years ago)
Author:
Jun Omae

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #12617, comment 6

    initial v1  
    1 We could //correct// such an offset of timezone with the same way of pytz:
     1We could //correct// such an offset of timezone with the same way of pytz, https://github.com/stub42/pytz/blob/release_2016.10/src/pytz/tzfile.py#L116:
    22
    33{{{#!diff
     
    1717+            # Avoid "ValueError: tzinfo.utcoffset() must return a whole
    1818+            # number of minutes" (#12617)
    19 +            offset = timedelta(seconds=seconds - mod + (0 if mod < 30 else 60))
     19+            offset = timedelta(seconds=int((seconds + 30) // 60) * 60)
    2020+        return offset
    2121