Whole file
pganssle/zoneinfo
The author described this change as “Fix support for numeric and julian offsets”. It counts as a record because the check below fails on the code as it stood at 153e18fba and passes on e49b2bc3a, with nothing else changed between the two runs.
Projectpganssle/zoneinfo
Fix saved2020-03-03
Sharing licenceApache-2.0 · LICENSE
Change size+1 −4
What the code was meant to do, written into the code itself as a save note
Fix support for numeric and julian offsets
The change
| 606 | 606 | __slots__ = ["d", "julian", "hour", "minute", "second"] | |
| 607 | 607 | ||
| 608 | 608 | def __init__(self, d, julian, hour=2, minute=0, second=0): | |
| 609 | - | if julian: | |
| 610 | - | d -= 1 | |
| 611 | - | ||
| 612 | 609 | if not 0 <= d <= 365: | |
| 613 | 610 | if julian: | |
| 614 | 611 | min_day = 1 | |
| ⋯ | |||
| 630 | 627 | if self.julian and d >= 59 and calendar.isleap(year): | |
| 631 | 628 | d += 1 | |
| 632 | 629 | ||
| 633 | - | epoch = days_before_year * 86400 | |
| 630 | + | epoch = (days_before_year + d) * 86400 | |
| 634 | 631 | epoch += self.hour * 3600 + self.minute * 60 + self.second | |
| 635 | 632 | ||
| 636 | 633 | return epoch | |
The check that tells the two apart
fail→pass·tests/test_zoneinfo.py::TZStrTest::test_tzstr_from_utc
Check file tests/test_zoneinfo.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it153e18fba2ff23ab4ca492724622d10be01c5f38
Broken version dated2020-03-03
Modulezoneinfo._zoneinfo
Units changed_DayOffset
Fingerprint9b94431c4cee8d7c
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in pganssle/zoneinfo
- 2020-02-28Fix support for quoted DST strings