ezic:local_to_utc/2 added, working.

in the case of ambiguous timezones, an "ambiguous_zone" error is thrown with the two valid zones.
if no zones existed for the given local time (i.e. DST eliminated the hour in question), a "no_zone" error is thrown.
otherwise, the date is returned
This commit is contained in:
aj
2010-11-14 00:46:00 -08:00
parent 22395e2f47
commit bd4e6078f2
2 changed files with 23 additions and 3 deletions

View File

@@ -68,9 +68,18 @@ flatzone(Date, TzName) ->
, ezic_flatten:contains_date(Fz, Date)]),
qlc:e(Q)
end,
{atomic, [FlatZone]}= mnesia:transaction(F),
FlatZone.
{atomic, FlatZones}= mnesia:transaction(F),
case length(FlatZones) of
1 ->
hd(FlatZones);
2 ->
erlang:error(ambiguous_zone, FlatZones);
0 ->
erlang:error(no_zone);
_ ->
erlang:error(should_not_happen, {FlatZones, Date, TzName})
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%