ecrn_control (erlcron v1.3.8)

Global clock controller for the erlcron scheduler.

ecrn_control is a singleton gen_server that maintains the reference datetime used by all job agents. During normal operation the reference time tracks the real system clock. For testing, the clock can be advanced to any future point via set_datetime/2; every ecrn_agent process will then fast-forward, executing any jobs whose scheduled time falls within the elapsed interval before settling at the new reference time.

The server also provides the cancel/1 entry point that delegates to ecrn_reg and is exposed as erlcron:cancel/1.

Summary

Functions

Return the current datetime (universal) with the reference-clock adjustment.

Return the current datetime in universal or local time with the reference-clock adjustment.

Set the scheduler clock to DateTime on the given nodes.

Return the reference datetime (universal) used as the scheduler's clock base.

Return the reference datetime in universal or local time.

Reset the scheduler clock to the current real system time.

Set the scheduler clock to DateTime (local time).

Functions

cancel(AlarmRef)

-spec cancel(erlcron:job_ref()) -> boolean().

code_change(OldVsn, State, Extra)

datetime()

-spec datetime() -> {calendar:datetime(), erlcron:milliseconds()}.

Return the current datetime (universal) with the reference-clock adjustment.

datetime/1

-spec datetime(local | universal) -> {calendar:datetime(), erlcron:milliseconds()}.

Return the current datetime in universal or local time with the reference-clock adjustment.

handle_call/3

handle_cast(Msg, State)

handle_info(Info, State)

init/1

multi_set_datetime/2

-spec multi_set_datetime([node()], calendar:datetime()) -> {Replies, BadNodes}
                            when Replies :: [{node(), ok | {error, term()}}], BadNodes :: [node()].

Set the scheduler clock to DateTime on the given nodes.

ref_datetime()

-spec ref_datetime() -> {calendar:datetime(), erlcron:milliseconds()}.

Return the reference datetime (universal) used as the scheduler's clock base.

ref_datetime/1

-spec ref_datetime(local | universal) -> {calendar:datetime(), erlcron:milliseconds()}.

Return the reference datetime in universal or local time.

reset_datetime()

-spec reset_datetime() -> ok | {error, term()}.

Reset the scheduler clock to the current real system time.

set_datetime(DateTime)

-spec set_datetime(calendar:datetime()) -> ok | {error, term()}.

Set the scheduler clock to DateTime (local time).

set_datetime/2

-spec set_datetime(calendar:datetime(), local | universal) -> ok | {error, term()}.

start_link()

-spec start_link() -> {ok, pid()} | ignore | {error, Error :: term()}.

terminate(Reason, State)