max_year base case bug fixed. ezic:localtime/1 works.
the final flatzone for every Zone should end at "current" for every *_to time. This is inaccurate, but accuracy is only guaranteed up to ?MAX_YEAR (=2500 by default). that working, I fleshed out the few methods required to get ezic:utc_to_localtime/2 working, thus localtime/1 working. I've only tested localtime/1 at this point. additionally, mnesia appears to have its data corrupted every time I stop and start a node. I've got to read up on working with mnesia; it's not behaving as I would expect.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
|
||||
-export([zones/1, rules/1, flatzones/1, flatzone/2]).
|
||||
-export([wipe/0, init/0, insert_all/1, get_all/1]).
|
||||
-export([wipe/0, wipe/1, init/0, insert_all/1, get_all/1]).
|
||||
|
||||
|
||||
-define(create(Record),
|
||||
@@ -63,10 +63,9 @@ flatzones(TzName) ->
|
||||
flatzone(Date, TzName) ->
|
||||
F = fun()->
|
||||
Q = qlc:q(
|
||||
[Fz || Fz=#flatzone{tzname=N, utc_from=UF, utc_to=UT} <- mnesia:table(flatzone)
|
||||
, N=:=TzName
|
||||
, ezic_date:compare(UF, Date)
|
||||
, ezic_date:compare(Date, UT)]),
|
||||
[Fz || Fz=#flatzone{tzname=N} <- mnesia:table(flatzone)
|
||||
, N=:=TzName
|
||||
, ezic_flatten:contains_date(Fz, Date)]),
|
||||
qlc:e(Q)
|
||||
end,
|
||||
{atomic, [FlatZone]}= mnesia:transaction(F),
|
||||
@@ -108,6 +107,16 @@ wipe() ->
|
||||
mnesia:delete_schema([node()]).
|
||||
|
||||
|
||||
|
||||
% WARNING: deletes all entries in table Tab
|
||||
wipe(Tab) ->
|
||||
mnesia:transaction(
|
||||
fun()->
|
||||
mnesia:delete(Tab, '_', write)
|
||||
end).
|
||||
|
||||
|
||||
|
||||
create_tabs(ok) ->
|
||||
mnesia:start(),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user