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 observances, and when it finds a
matching observance it looks ahead to the next one to check specially
for ambiguity.  It returns the later span if there's an ambiguity due
specifically to a change from DST to non-DST; it doesn't have guaranteed
behaviour in any other ambiguity scenario.  DT:TZ doesn't document this
feature, and doesn't offer any other form of ambiguity detection in its
API (though of course it would be possible to add some).

>                                       and if you subtract an hour from
>the later (ambiguous) time, you'll get the same time, but the earlier
>one (provided the clock is turned back by an hour when switching back).

You can't rely on offset changes, even specifically ones for DST, being of
an hour.  Australia/Lord_Howe (Lord Howe Island) does a regular half-hour
DST jump.

-zefram

Reply via email to