[Datetime-SIG] PEP-431/495

Stuart Bishop stuart at stuartbishop.net
Sun Aug 23 08:13:31 CEST 2015


On 21 August 2015 at 23:59, Alexander Belopolsky
<alexander.belopolsky at gmail.com> wrote:
>
> On Fri, Aug 21, 2015 at 8:07 AM, Stuart Bishop <stuart at stuartbishop.net>
> wrote:
>>
>> - The rules in PEP-495 for utcoffset() and dst() to deal with
>> ambiguous times only work in simple cases, as there dst offsets both
>> more and less than 1 hour, and there is no stdoffset since the offset
>> can change at the same time (eg. Europe/Vilnius 1941, where the clocks
>> ended up going backwards for summer time instead of forwards).
>
>
> Instead of engaging in a theoretical discussion, I went ahead and added this
> transition as a test case to my reference implementation.  Please review [1]
> and let me know if you see any issues.
>
> [1]:
> https://github.com/abalkin/cpython/commit/9f683c8d0f6f2b48aad81ae4e5e8a118a542d2d4

Seems fine.

If you want more amusing test cases, the ones I have tripped over are
in http://bazaar.launchpad.net/~stub/pytz/devel/view/head:/src/pytz/tests/test_tzinfo.py.
I think the one least likely to be covered is Pacific/Apia (Samoa) in
2011, when they jumped the international dateline. No dst transition,
but the offset changed from -10 to +14 and they skipped Dec 30th
entirely.

-- 
Stuart Bishop <stuart at stuartbishop.net>
http://www.stuartbishop.net/


More information about the Datetime-SIG mailing list