[Datetime-SIG] Visualizing the DST transitions

Carl Meyer carl at oddbird.net
Wed Oct 21 23:42:26 CEST 2015


On 10/21/2015 03:27 PM, Alexander Belopolsky wrote:
> I just wanted to share a slide
> <https://docs.google.com/presentation/d/1H1tkvg_vm39jXPZbOvQLoWb32POSpTYiZx8qMtBvdSQ/pub?start=false&loop=false&delayms=3000&slide=id.gdfc9fbb2b_0_74> 
> [1] I came across that is very similar to the sketches in PEP 495.  Does
> anyone understand how CCTZ handles the discontinuities?

It provides two APIs, MakeTime and MakeTimeInfo, which both accept a
"naive datetime" and a timezone.

MakeTime returns an absolute time, and discontinuities are handled by
always assuming the pre-transition offset:
https://github.com/google/cctz/blob/master/src/cctz.h#L131

MakeTimeInfo returns a more complex TimeInfo struct which has a `kind`
enum member that can be `UNIQUE` (the normal case), `SKIPPED`, or
`REPEATED`, and has `pre`, `post`, and `trans` timestamp members
(containing the time calculated using the pre-transition offset, the
time calculated using the post-transition offset, and the time at which
the transition occurs), which in the normal case of `UNIQUE` are all set
to the same value. Documentation starts here:
https://github.com/google/cctz/blob/master/src/cctz.h#L142

Carl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/datetime-sig/attachments/20151021/d0c80e66/attachment.sig>


More information about the Datetime-SIG mailing list