Module quartz

Erlang Time Manager.

Copyright © 2010-2013 ALEPH ARCHIVES Ltd. All rights reserved.

Version: 1.1.0

Authors: Aleph Archives Ltd. [web site: http://aleph-archives.com/].

Description

Erlang Time Manager.

Scalable timing module with Unix "CRON/AT" capabilities and more.

Data Types

timer()

timer() = non_neg_integer() | {non_neg_integer(), non_neg_integer()} | {non_neg_integer(), infinity, non_neg_integer()} | {non_neg_integer(), pos_integer(), non_neg_integer()} | [non_neg_integer()]

tref()

tref() = {non_neg_integer(), reference()}

Function Index

apply_after/2Equivalent to call apply_after('quartz', Time, Fun).
apply_after/3Evaluates Fun() on quartz TimerId server after Time amount of time has elapsed.
apply_after/4Equivalent to call apply_after('quartz', Time, M, F, A).
apply_after/5Evaluates apply(Module, Function, Arguments) after Time amount of time has elapsed.
apply_at/2Equivalent to quartz:apply_at('quartz',TimeSpec,Fun).
apply_at/3Evaluates Fun() once on quartz TimerId server at first occurrence of datetime defined by "TimeSpec".
apply_at/4Equivalent to quartz:apply_at('quartz',TimeSpec,M,F,A).
apply_at/5Evaluates apply(TimerId,Module,Function,Arguments) once at first occurrence of datetime defined by "TimeSpec".
apply_interval/2Equivalent to call apply_interval('quartz', Time, Fun).
apply_interval/3Evaluates Fun() on quartz TimerId server repeatedly at intervals of Time.
apply_interval/4Equivalent to call apply_interval('quartz', Time, M, F, A).
apply_interval/5Evaluates apply(TimerId,Module,Function,Arguments) repeatedly at intervals of Time.
cancel/1Equivalent to cancel('quartz', TimerRef).
cancel/2Cancels a previously requested timeout.
cancel_all/0Equivalent to cancel_call('quartz').
cancel_all/1Cancels all the scheduled jobs for quartz named "TimerId".
exit_after/2Equivalent to exit_after(Time, self(), Reason).
exit_after/3Equivalent to exit_after('quartz', Time, Pid, Reason).
exit_after/4Send an exit signal with reason Reason1 to pid Pid.
kill_after/1Equivalent to kill_after('quartz', Time, self(), kill).
kill_after/2Equivalent to kill_after('quartz', Time, Pid, kill).
kill_after/3Same as exit_after(TimerId, Time, Pid, kill).
localtime/0Returns the current local date and time {{Year, Month, Day}, {Hour, Minute, Second}}.
now/0Returns the tuple {MegaSecs, Secs, MicroSecs} which is the elapsed time since 00:00 GMT, January 1, 1970 (zero hour).
revision/0Returns the current QUARTZ revision number.
schedule/2Equivalent to quartz:schedule('quartz',TimeSpec,Fun]).
schedule/3Evaluates Fun() on quartz TimerId server repeatedly at intervals of "TimeSpec" as defined in module "quartz_sched".
schedule/4Equivalent to quartz:schedule('quartz',TimeSpec,atom(),atom(),[term()]).
schedule/5Evaluates apply(TimerId,Module,Function,Arguments) repeatedly at intervals of "TimeSpec" as defined in module "quartz_sched".
send_after/2Equivalent to send_after(Time, self(), Message).
send_after/3Equivalent to send_after('quartz', Time, Pid, Message).
send_after/4Evaluates Pid !
send_interval/2Equivalent to send_interval(Time, self(), Message).
send_interval/3Equivalent to send_interval('quartz', Time, Pid, Message).
send_interval/4Evaluates Pid !
start_link/0Equivalent to: start_link('quartz').
start_link/1Equivalent to start_link(TimerId, false).
start_link/2Start a named QUARTZ time server "TimerId" and link it or not to the calling process.
stop/0Equivalent to stop(?MODULE).
stop/1Stop the quartz namespace "Pid".
tc/1Evaluates Fun().
tc/2Evaluates apply(Fun, Arguments).
tc/3Evaluates apply(Module, Function, Arguments) and measures the elapsed real time as reported by os:timestamp/0.
timestamp/0Returns a tuple in the same format as erlang:now/0.
universaltime/0Returns the current date and time according to Universal Time Coordinated (UTC), also called GMT.
version/0Returns the current QUARTZ version number.

Function Details

apply_after/2

apply_after(Time::non_neg_integer(), Fun::function()) -> {ok, tref()} | {error, badarg}

Equivalent to call apply_after('quartz', Time, Fun).

apply_after/3

apply_after(TimerId::pid() | atom(), Time::non_neg_integer(), Fun::function()) -> {ok, tref()} | {error, badarg}

Evaluates Fun() on quartz TimerId server after Time amount of time has elapsed. Returns {ok, TRef} | {error, Reason}.

Just like timer:apply_after/4 but also supports "fun()" instead of M,F,A.

apply_after/4

apply_after(Time::non_neg_integer(), M::atom(), F::atom(), A::[term()]) -> {ok, tref()} | {error, badarg}

Equivalent to call apply_after('quartz', Time, M, F, A).

apply_after/5

apply_after(TimerId::pid() | atom(), Time::non_neg_integer(), M::atom(), F::atom(), A::[term()]) -> {ok, tref()} | {error, badarg}

Evaluates apply(Module, Function, Arguments) after Time amount of time has elapsed. Returns {ok, TRef} | {error, Reason}.

Just like timer:apply_after/4 but also supports "fun()" instead of M,F,A.

apply_at/2

apply_at(TimeSpec::quartz_sched:timespec(), Fun::function()) -> {ok, tref()} | {error, term()}

Equivalent to quartz:apply_at('quartz',TimeSpec,Fun).

apply_at/3

apply_at(TimerId::pid() | atom(), TimeSpec::quartz_sched:timespec(), Fun::function()) -> {ok, tref()} | {error, term()}

Evaluates Fun() once on quartz TimerId server at first occurrence of datetime defined by "TimeSpec". Returns {ok, TRef} | {error, Reason}.

This call mimics the behaviour of the Unix command at.

See also: quartz_sched:sched().

apply_at/4

apply_at(TimeSpec::quartz_sched:timespec(), M::atom(), F::atom(), A::[term()]) -> {ok, tref()} | {error, term()}

Equivalent to quartz:apply_at('quartz',TimeSpec,M,F,A).

apply_at/5

apply_at(TimerId::pid() | atom(), TimeSpec::quartz_sched:timespec(), M::atom(), F::atom(), A::[term()]) -> {ok, tref()} | {error, term()}

Evaluates apply(TimerId,Module,Function,Arguments) once at first occurrence of datetime defined by "TimeSpec". Returns {ok, TRef} | {error, Reason}.

This call mimics the behaviour of the Unix command at.

See also: quartz_sched:sched().

apply_interval/2

apply_interval(Time::timer(), Fun::function()) -> {ok, tref()} | {error, badarg} | {error, no_pid}

Equivalent to call apply_interval('quartz', Time, Fun).

Just like timer:apply_interval/4, but also supports "fun()" instead of an M,F,A.

apply_interval/3

apply_interval(TimerId::pid() | atom(), Time::timer(), Fun::function()) -> {ok, tref()} | {error, badarg} | {error, no_pid}

Evaluates Fun() on quartz TimerId server repeatedly at intervals of Time. Returns {ok, TRef} | {error, Reason}.

Support advanced "repetition" modes:

apply_interval/4

apply_interval(Time::timer(), M::atom(), F::atom(), A::[term()]) -> {ok, tref()} | {error, badarg} | {error, no_pid}

Equivalent to call apply_interval('quartz', Time, M, F, A).

Just like timer:apply_interval/4.

apply_interval/5

apply_interval(TimerId::pid() | atom(), Time::timer(), M::atom(), F::atom(), A::[term()]) -> {ok, tref()} | {error, badarg} | {error, no_pid}

Evaluates apply(TimerId,Module,Function,Arguments) repeatedly at intervals of Time. Returns {ok, TRef} | {error, Reason}.

Support advanced "repetition" modes:

cancel/1

cancel(BRef::tref()) -> ok | {error, term()}

Equivalent to cancel('quartz', TimerRef). Just like timer:cancel/1.

cancel/2

cancel(TimerId::pid() | atom(), BRef::tref()) -> cancel | {error, term()}

Cancels a previously requested timeout. TRef is a unique timer reference returned by the timer function in question. Returns {ok, cancel}, or {error, Reason} when TRef is not a timer reference.

cancel_all/0

cancel_all() -> ok | {error, term()}

Equivalent to cancel_call('quartz').

cancel_all/1

cancel_all(TimerId::pid() | atom()) -> ok | {error, term()}

Cancels all the scheduled jobs for quartz named "TimerId".

exit_after/2

exit_after(Time::non_neg_integer(), Reason::term()) -> {ok, tref()} | {error, term()}

Equivalent to exit_after(Time, self(), Reason).

Just like timer:exit_after/2.

exit_after/3

exit_after(Time::non_neg_integer(), Pid::pid(), Reason::term()) -> {ok, tref()} | {error, term()}

Equivalent to exit_after('quartz', Time, Pid, Reason). Just like timer:exit_after/3.

exit_after/4

exit_after(TimerId::pid() | atom(), Time::non_neg_integer(), Pid::pid(), Reason::term()) -> {ok, tref()} | {error, term()}

Send an exit signal with reason Reason1 to pid Pid. Returns {ok, TRef}, or {error, Reason2}.

kill_after/1

kill_after(Time::non_neg_integer()) -> {ok, tref()} | {error, term()}

Equivalent to kill_after('quartz', Time, self(), kill).

Just like timer:kill_after/1.

kill_after/2

kill_after(Time::non_neg_integer(), Pid::pid()) -> {ok, tref()} | {error, term()}

Equivalent to kill_after('quartz', Time, Pid, kill).

Just like timer:kill_after/2.

kill_after/3

kill_after(TimerId::pid() | atom(), Time::non_neg_integer(), Pid::pid()) -> {ok, tref()} | {error, term()}

Same as exit_after(TimerId, Time, Pid, kill).

Just like timer:kill_after/2.

localtime/0

localtime() -> calendar:datetime()

Returns the current local date and time {{Year, Month, Day}, {Hour, Minute, Second}}. Wrapper around erlang:localtime/0.

now/0

now() -> erlang:timestamp()

Returns the tuple {MegaSecs, Secs, MicroSecs} which is the elapsed time since 00:00 GMT, January 1, 1970 (zero hour). Wrapper around erlang:now/0.

revision/0

revision() -> string()

Returns the current QUARTZ revision number.

schedule/2

schedule(TimeSpec::quartz_sched:timespec(), Fun::function()) -> {ok, tref()} | {error, term()}

Equivalent to quartz:schedule('quartz',TimeSpec,Fun]).

schedule/3

schedule(TimerId::pid() | atom(), TimeSpec::quartz_sched:timespec() | {after_ms, non_neg_integer()}, Fun::function()) -> {ok, tref()} | {error, term()}

Evaluates Fun() on quartz TimerId server repeatedly at intervals of "TimeSpec" as defined in module "quartz_sched".

Returns {ok, TRef} | {error, Reason}.

See also: quartz_sched:sched().

schedule/4

schedule(TimeSpec::quartz_sched:timespec() | {after_ms, non_neg_integer()}, M::atom(), F::atom(), A::[term()]) -> {ok, tref()} | {error, term()}

Equivalent to quartz:schedule('quartz',TimeSpec,atom(),atom(),[term()]).

schedule/5

schedule(TimerId::pid() | atom(), TimeSpec::quartz_sched:timespec() | {after_ms, non_neg_integer()}, M::atom(), F::atom(), A::[term()]) -> {ok, tref()} | {error, term()}

Evaluates apply(TimerId,Module,Function,Arguments) repeatedly at intervals of "TimeSpec" as defined in module "quartz_sched". Returns {ok, TRef} | {error, Reason}.

See also: quartz_sched:sched().

send_after/2

send_after(Time::non_neg_integer(), Message::term()) -> {ok, tref()} | {error, term()}

Equivalent to send_after(Time, self(), Message).

Just like timer:send_after/2.

send_after/3

send_after(Time::non_neg_integer(), Pid::pid(), Message::term()) -> {ok, tref()} | {error, term()}

Equivalent to send_after('quartz', Time, Pid, Message).

Just like timer:send_after/3.

send_after/4

send_after(TimerId::pid() | atom(), Time::non_neg_integer(), Pid::pid(), Message::term()) -> {ok, tref()} | {error, term()}

Evaluates Pid ! Message after Time amount of time has elapsed. (Pid can also be an atom of a registered name.) Returns {ok, TRef}, or {error, Reason}.

send_interval/2

send_interval(Time::non_neg_integer(), Message::term()) -> {ok, tref()} | {error, term()}

Equivalent to send_interval(Time, self(), Message).

Just like timer:send_interval/2.

send_interval/3

send_interval(Time::non_neg_integer(), Pid::pid(), Message::term()) -> {ok, tref()} | {error, term()}

Equivalent to send_interval('quartz', Time, Pid, Message).

Just like timer:send_interval/3.

send_interval/4

send_interval(TimerId::pid() | atom(), Time::non_neg_integer(), Pid::pid(), Message::term()) -> {ok, tref()} | {error, term()}

Evaluates Pid ! Message repeatedly after Time amount of time has elapsed. (Pid can also be an atom of a registered name). Returns {ok, TRef} or {error, Reason}.

Support advanced "repetition" modes:

start_link/0

start_link() -> {ok, pid()}

Equivalent to: start_link('quartz').

start_link/1

start_link(TimerId::atom()) -> {ok, pid()}

Equivalent to start_link(TimerId, false).

start_link/2

start_link(TimerId::atom(), Link::boolean()) -> {ok, pid()}

Start a named QUARTZ time server "TimerId" and link it or not to the calling process.

The Link argument specifies if Quartz should link to the calling process or not (default false). If Link equals 'true', and the caller dies after successfully scheduling some tasks (via apply_interval, apply_at, etc.), all these tasks will be unscheduled (i.e deleted and more no executed).

stop/0

stop() -> ok

Equivalent to stop(?MODULE).

stop/1

stop(Pid::pid() | atom()) -> ok

Stop the quartz namespace "Pid".

tc/1

tc(Fun::function()) -> {non_neg_integer(), term()}

Evaluates Fun(). Otherwise works like tc/2.

Just like timer:tc/1.

tc/2

tc(Fun::function(), Args::[term()]) -> {non_neg_integer(), term()}

Evaluates apply(Fun, Arguments). Otherwise works like tc/3.

Just like timer:tc/2.

tc/3

tc(M::atom(), F::atom(), A::[term()]) -> {non_neg_integer(), term()}

Evaluates apply(Module, Function, Arguments) and measures the elapsed real time as reported by os:timestamp/0.

Returns {Time, Value}, where Time is the elapsed real time in microseconds, and Value is what is returned from the apply.

Just like timer:tc/3.

timestamp/0

timestamp() -> erlang:timestamp()

Returns a tuple in the same format as erlang:now/0. The difference is that this function returns what the operating system thinks (a.k.a. the wall clock time) without any attempts at time correction. The result of two different calls to this function is not guaranteed to be different. Wrapper around os:timestamp/0.

universaltime/0

universaltime() -> calendar:datetime()

Returns the current date and time according to Universal Time Coordinated (UTC), also called GMT. Wrapper around erlang:universaltime/0.

version/0

version() -> string()

Returns the current QUARTZ version number.


Generated by EDoc, Jun 3 2013, 02:20:35.