Re: How to tell (in advance) if a date-time is ambiguous?

2017-07-11 Thread Zefram
Dave Rolsky wrote: >If you're trying to avoid these, the best advice I could give would be to >avoid the 12am-4am window, which AFAIK is when most (all?) transitions have >occurred historically. Most, but there are both historical and current exceptions. America/Godthab (west Greenland) changes

Re: How to tell (in advance) if a date-time is ambiguous?

2017-07-11 Thread Zefram
Binarus wrote: >As the documentation tells us, DateTime always chooses the later time >when calculating with ambiguous times, This logic is actually in DateTime::TimeZone, where DateTime invokes it via the ->offset_for_local_datetime method. The internal logic is able to walk the sequence of

Re: How to tell (in advance) if a date-time is ambiguous?

2017-07-11 Thread Zefram
Binarus wrote: >Did you memorize the tzfile of 1969 :-) I looked through the Olson source files. I could also have automated a search through the compiled zone data. -zefram

Re: How to check if a DateTime is invalid (again - but this time without using eval)?

2017-07-11 Thread Dave Rolsky
On Tue, Jul 11, 2017 at 10:56 AM, Paul Hoffman wrote: > On Mon, Jul 10, 2017 at 09:44:15PM +0100, Zefram wrote: > > Thomas (HFM) Wyant wrote: > > >One of the edge cases with eval {} is the possibility that $@ gets > > >clobbered before you get your hands on it. > > > > The

TimeZones and politics Re: How to tell (in advance) if a date-time is ambiguous?

2017-07-11 Thread Bill Ricker
On Tue, Jul 11, 2017 at 4:07 AM, Binarus wrote: > > On 10.07.2017 20:14, Eric Brine wrote: > > I don't understand the conditions. The law determines when the switching > > of offsets from UTC happen, not some person. The switch doesn't happen > > at 08:48:27 am in Chicago; it

Re: TimeZones and politics Re: How to tell (in advance) if a date-time is ambiguous?

2017-07-11 Thread Zefram
Bill Ricker wrote: >On Tue, Jul 11, 2017 at 4:07 AM, Binarus wrote: >> and the next law could determine the switch to >> happen at 08:48:27 am, and > >It could in theory, but would be beyond atypical. There have historically been some DST rules calling for changes at 00:01.

Re: How to tell (in advance) if a date-time is ambiguous?

2017-07-11 Thread Binarus
On 10.07.2017 23:17, Bill Ricker wrote: > On Mon, Jul 10, 2017 at 2:19 PM, Dave Rolsky > wrote: > >[...] > If you're trying to avoid these, the best advice I could give would > be to avoid the 12am-4am window, which AFAIK is when most (all?) >

Re: How to tell (in advance) if a date-time is ambiguous?

2017-07-11 Thread Binarus
On 11.07.2017 01:09, Zefram wrote: > Binarus wrote: >> Using DateTime, is it possible to tell in advance if a certain date-time >> which is given in a certain locale will be ambiguous due to switching >>from DST to standard time? > > That is tricky. I don't think our APIs provide any way to do

Re: How to tell (in advance) if a date-time is ambiguous?

2017-07-11 Thread Binarus
On 10.07.2017 20:19, Dave Rolsky wrote: > While you could in theory write code that would be correct for all past > datetimes, the future doesn't work the same way. As Eric noted, time > zones are political. I have seen DST transitions altered with mere days > (or less!) notice given. This means

Re: How to tell (in advance) if a date-time is ambiguous?

2017-07-11 Thread Binarus
On 10.07.2017 20:14, Eric Brine wrote: > I don't understand the conditions. The law determines when the switching > of offsets from UTC happen, not some person. The switch doesn't happen > at 08:48:27 am in Chicago; it happens at 2am. This point of view is a bit U.S. centric. Indeed, you are