Re: First time of the day
[email protected] (Zefram) Tue, 31 Dec 2013 04:24:45 +0000
| Newsgroups | perl.datetime |
|---|---|
| Message-ID | <[email protected]> |
Eric Brine wrote: >I posted a solution here: >http://stackoverflow.com/a/20850899/589924 That message states |On the DateTime mailing list, Zefram suggested I do a binary search on |the time zone data. The following is an implementation of that solution: which is not correct. I did not suggest searching among observance spans, as the code there does. I suggested searching among UT times. Please post a correction. >I perform a binary search of the tz's spans, looking at the *local* times. This is a valid approach *if* you have access to the span data itself. The code you posted on stackoverflow uses the internals of the current DT:TZ implementation. The public API for DT:TZ objects doesn't support this. That's (in part) why I suggested an algorithm that only accesses zone data in the form of UT->local conversions. >*I made one assumption*: There is no dt to which one can add time to obtain >a dt with an earlier date. That's the same assumption I made, which I reckon is justified by the Olson database. -zefram