[tz] How to compute the moment of the next DST change

Boruch Baum boruch_baum at gmx.com
Wed Apr 3 14:12:16 UTC 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

A few months ago, I posted to this list (and posted source code to
github https://github.com/Boruch-Baum/zdump-3-) a C function that I
think will do what you all want. No heuristics or guessing.

For the use case "compute the moment of the next DST change", pass to
the function the current time/date as the start period, and a 'safe'
date in the future (say one year hence). The second entry in the
returned struct will be "moment of the next DST change".

On 04/03/2013 01:55 AM, Simon Perreault wrote:
> Le 2013-04-03 04:45, Paul Eggert a écrit :
>>> Looking at the source code of
>>> "calendar-next-time-zone-transition", it looks very error prone
>>> to me. Am I reading the comments right? It initializes a binary
>>> search with the results of a heuristic?
>> 
>> Yes.  It's a heuristic that should work with all real-world time
>> zone histories (including all time zone histories in the tz
>> database). It won't work in general, though.
> 
> Thanks! That's what I expected.
> 
>> zdump uses a similar heuristic, if memory serves.
> 
> I suppose magic doesn't exist after all...
> 
> Simon


- -- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJRXDi0AAoJEDvrUfDmCx9LMOMP/RcT040gz2L/UXH5tFp9NefJ
Fwl5LEJ20OgsVNhGRMj/CUVqb6PVpd/hPZ3eMY659Xi0FGx2lHFTynmklGoTDpJH
wusvEu21+VABU527SzJwDtjjeBhbeKIdb+tRikNRVYUICsdxhddZiiT+8hbdjFlJ
iNq6po9Vdw+Ik5C/Y7BC9nsys5fO49CGS6lWMiTnTOIVa6URCYfhC/Su6bTGBySG
ikrTxTCAUxxlskPKSVuNoD2sumy+5R50Lm/vNBM3GnwkTA+wBqqrVG8AzmhVNyp2
MvCEW4Q9S6tNT5gFeFunJkpomhpctPTEDZEI0p3r4UmM2S+eYSE+7ZvKpcCUrepF
i5q78YnerR37uq+U0mIdd3U0f0MwyKOR/GJGrnspTcrKYTZlQQiyq5a1D8+gJx15
5lZCHptEtZzV8DYCGot3ypq9I0k4hhmh37qkDFK5dlHVk9Xy1DBuLq8w18CxUFfd
1tUQY4fRnvd2J+vy55uTJbeSODOPmWwhAhY/Lnyt7Vv/X5LWRZ3Z4K08ovy/ECGy
X+FJ6xVf++B9BEtcRL3v5U6CB0iF1BEiilzCJbOnDg0O0mQGjqLLVmAn3RREBJVa
pA7Q84XHdtrPYeGD69YsXI5HHeJtCQNPXZIZS31FIFjX0iCEnrLpehvg4iqYzkRM
ys+JLXNpNBoXFUqS3BbC
=ceqW
-----END PGP SIGNATURE-----


More information about the tz mailing list