[Datetime-SIG] PEP 495 (Local Time Disambiguation) is ready for pronouncement

Tim Peters tim.peters at gmail.com
Sun Aug 16 21:59:23 CEST 2015


[Guido]
> ...
> - In a reply to this thread, you wrote "The rule for the missing time is the
> opposite to that for the ambiguous time. This allows a program that probes
> the TZ database by calling timestamp with two different values of the
> "first" flag to avoid any additional calls to differentiate between the gap
> and the fold." Can you clarify this (I'm not sure how this works, though I
> intuitively agree that the two rules should be each other's opposite) and
> add it to the PEP?

If ts_true is the timestamp with first=True, and ts_false the
timestamp with first=False, then:

- The original time was ambiguous (fold) iff ts_true < ts_false.
- The original time was invalid (in a gap) iff ts_true > ts.false.
- The original time was neither ambiguous nor invalid iff ts_true == ts._false.

At least that was my guess ;-)  I agree the PEP should spell it out regardless.


More information about the Datetime-SIG mailing list