Add default_timezone environemnt variable

This commit is contained in:
Jesse Gumm 2013-03-24 14:00:11 -05:00
parent 798a5b1ebc
commit 1391f38558

View file

@ -40,7 +40,17 @@
%% It's used to convert to and from unixtime, since unixtime starts %% It's used to convert to and from unixtime, since unixtime starts
%% 1970-01-01 12:00am %% 1970-01-01 12:00am
-define(UNIXTIME_BASE,62167219200). -define(UNIXTIME_BASE,62167219200).
-define(DEFAULT_TZ, "GMT").
%% This is the timezone only if the qdate application variable
%% "default_timezone" isn't set or is set to undefined.
%% It's recommended that your app sets the var in a config, or at least using
%%
%% application:set_env(qdate, default_timezone, "GMT").
%%
-define(DEFAULT_TZ, case application:get_env(qdate, default_timezone) of
undefined -> "GMT";
TZ -> TZ
end).
to_string(Format) -> to_string(Format) ->
to_string(Format, now()). to_string(Format, now()).