On Sat, Apr 23, 2016 at 3:42 PM, Eric Brine <ikeg...@adaelis.com> wrote:
> On Fri, Apr 22, 2016 at 8:04 PM, Zefram <zef...@fysh.org> wrote: > >> 18 steps >> of binary search gets you down to the second, but actually modern zones >> are always on integral-minute offsets, so you could look only at integral >> minutes and take only 12 steps. For each UT time you try, convert it >> to zone time and see which month it ends up in. >> > > I can't figure out how to search only down to the minute without causing > it to find the wrong answer on days with two midnights. > Nevermind. $dt->truncate( to => 'minute') doesn't work, but $dt->subtract( seconds => $dt->second ) does. Optimized the linked code.