updates README; removes unused functions

This commit is contained in:
aj heller
2012-12-17 18:14:44 -08:00
parent 843a03c09b
commit 8d4109aadf
2 changed files with 7 additions and 67 deletions

View File

@@ -28,14 +28,6 @@ API
* `ezic:localtime(TimeZone) -> datetime()`
* `ezic:utc_to_local(universal_datetime(), TimeZone) -> local_datetime()`
* `ezic:local_to_utc(local_datetime(), TimeZone) -> universal_datetime()`
* `ezic:zone_convert(from_datetime(), TimeZoneFrom, TimeZoneTo) -> to_datetime()`
Admin API
-------
* `ezic:load("/path/to/tzdata") -> ok`
@@ -78,6 +70,10 @@ To maintain ezic's status as a public domain work, all contributions must also b
Acknowledgements
----------------
A big thanks to ezic's contributors:
* lsowen
The decision to release this into the public domain was inspired by the (anti-) license of the [SQLite project](http://www.sqlite.org/copyright.html).

View File

@@ -5,37 +5,26 @@
localtime/1
, utc_to_local/2
, local_to_utc/2
, next_timechange/1
, next_timechange_after/2
]).
-export([
load/1
, dev/0
, test/0
, reflatten/0
, zf/0
]).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PUBLIC API
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% returns local time in given timezone
localtime(TzName) ->
utc_to_local(erlang:universaltime(), TzName).
%% returns time in given timezone for corresponding utc time
utc_to_local(UTCDatetime, TzName) ->
NormalDatetime= ezic_date:normalize(UTCDatetime, u),
utc_to_local_handleFlatzone(UTCDatetime, ezic_db:flatzone(NormalDatetime, TzName)).
%% returns utc time for corresponding time in given timezone utc
local_to_utc(LocalDatetime, TzName) ->
NormalDatetime= ezic_date:normalize(LocalDatetime, w),
#flatzone{offset=Offset, dstoffset=DSTOffset}= ezic_db:flatzone(NormalDatetime, TzName),
@@ -45,51 +34,6 @@ local_to_utc(LocalDatetime, TzName) ->
LocalDatetime
, Offset, {0,0,0})
, DSTOffset, {0,0,0}).
next_timechange(TzName) ->
next_timechange_after(erlang:universaltime(), TzName).
next_timechange_after(_UTCDatetime, _TzName) ->
not_done.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DEV API
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load(Folder) ->
ezic_loader:load(Folder).
dev() ->
application:start(ezic),
ezic_db:flatzone({{2010,11,17}, #tztime{time={23,42,0}}}, "America/Los_Angeles"),
ok.
zf() ->
Zones= ezic_db:zones("Asia/Tokyo"),
ezic_flatten:flatten_all_zones(Zones).
reflatten() ->
ezic_db:wipe(flatzone),
ezic_db:flatten().
test() ->
lists:foreach(
fun(TZ)->
io:format("~s: ~p~n", [TZ, localtime(TZ)])
end,
["Asia/Tokyo", "America/New_York", "America/Los_Angeles", "America/Jamaica", "Australia/Adelaide"]).