Re: [Datetime-SIG] DST explained visually
On Wed, Aug 26, 2015 at 12:37 PM, Alexander Belopolsky < alexander.belopolsky@gmail.com> wrote:
On Wed, Aug 26, 2015 at 3:00 PM, Guido van Rossum
wrote: The proposal in PEP 495 adds a 'fold' flag whose value is 0 *except* for local times mapped from UTC period C-D; between C and D local time is between R and S with fold=1. (Note that the current text of the PEP has a flag named 'first' whose definition is the opposite; but the plan is to switch to fold=0. In any case it's one bit of information and it's only used for times between P-Q.)
I have edited [1] your sketch to show the UTC mappings of two local times: g in the gap and f in the fold: (g, fold=0) maps to G0, (g, fold=1) maps to G1, (f, fold=0) maps to F0, and (f, fold=1) maps to F1. Note that G1 < G0 while F1 > F0. This may look arbitrary, but it follows from a consistent rule: fold=0 is the intersection with the line that is solid (valid) before the transition and fold=1 is the intersection with the line that is solid (valid) after the transition.
[1]: https://github.com/abalkin/ltdf/blob/master/dst-visual.jpg
Cool! Which reminds me, there are some edge cases to consider. What's the local time for UTC=A? And for UTC=C? I guess the rule is to use half-open intervals on the X axis that are open on the right, so that A maps to Q and C maps to R. -- --Guido van Rossum (python.org/~guido)
participants (1)
-
Guido van Rossum