fixes #7; adds many tests for #7; cleans up ezic_flatten debug messages

Issue #7: Some Zones no longer observing DST are broen.

The matchspec generation function for universal time was wrong,
whereas it was fine for wall and local times. Fixing that line, and
considering the `current` flatzone time, was enough to get TZs like
Tokyo and Jamaica working correctly in tested cases.
This commit is contained in:
aj heller
2012-12-17 23:53:08 -08:00
parent 959bb8a2a3
commit ca64849fed
3 changed files with 72 additions and 61 deletions

View File

@@ -30,13 +30,6 @@ parse([Name,GmtOffS,Rule,FormatS | UntilTokens]) ->
current(TzName) ->
current_as_of_utc(erlang:universaltime(), TzName).
@@ -101,10 +94,10 @@ project_end_utc(Zone=#zone{}, DSTOffset) ->
%% though it's very unlikely (and does not exist in the current tz database files).
%% this method covers that event, anyhow. see unit tests for examples.
next(ZoneList, UTCFrom, DSTOff) ->
?debugMsg("next:"),
?debugVal(ZoneList),
?debugVal(UTCFrom),
%% ?debugMsg("next:"),
%% ?debugVal(ZoneList),
%% ?debugVal(UTCFrom),
DatedList= lists:map(
fun(Z=#zone{until=Until, gmtoff=Offset})->
NUntil= ezic_date:normalize(Until),
@@ -113,7 +106,5 @@ next(ZoneList, UTCFrom, DSTOff) ->
end
, ZoneList),
FilteredList= lists:filter(fun({IDt,_})-> ezic_date:compare(UTCFrom, IDt) end, DatedList),
%x ?debugVal(FilteredList),
SortedList= lists:sort(fun({X,_},{Y,_})->ezic_date:compare(X,Y)end, FilteredList),
[Z || {_,Z}<- SortedList].