DayTimer:
Filter:
DayTimer/Classes (extension) | Utilities

DayTimer
ExtensionExtension

make actions happen at specific times of the day - hour/minute/second

Description

DayTimer allows scheduling actions to happen at specific times of day. This can be useful for installations that run unattended in museum or gallery situations. A DayTimer is stored by name, and can keep multiple actions to run at different times of day. There is a global DayTimer instance which may suffice for simple uses.

Class Methods

.all

a global dictionary where all DayTimers are stored.

.at

look up a DayTimer in DayTimer.all by name.

.top

A global instance of DayTimer provided for convenience.

.putDate

add an action at <id> to the top DayTimer dates.

Arguments:

id

a symbol for the action to add to it.

test

a test whether to do the action at the current date/time. can be a function that looks at current date, or a list of [hour, minute, second] values.

func

the action to do when the time is right (test is true)

.removeAt

remove the action at <id> in the top DayTimer.

.start

start the top DayTimer.

.stop

stop the top DayTimer.

.new

store a new DayTimer or access an existing instance at the given name; optionally give it an id, a test whether the time of day is right, and the corresponding action.

Arguments:

name

a symbol for the DayTimer instance name.

id

a symbol for the action to add to it.

test

a test whether to do the action at the current date/time. can be a function that looks at current date, or a list of [hour, minute, second] values.

func

the action to do when the time is right (test is true)

Returns:

A new or existing DayTimer.

Instance Methods

.name

get the DayTimer name

Returns:

a Symbol

.dates

a dict of the named actions to do

.putDate

add an action at <id> to the DayTimer dates.

Arguments:

id

a symbol for the action to add to it.

test

a test whether to do the action at the current date/time. can be a function that looks at current date, or a list of [hour, minute, second] values.

func

the action to do when the time is right (test is true)

.removeAt

remove an action from dates by id

Arguments:

id

.start

start the DayTimer.

.stop

stop the DayTimer.

.skip

internal - a SkipJack that runs when DayTimer is active.

.checkList

internal - checks which time tests for actions match the current time, and performs the actions if any.

Examples