The timers module provides the ability for C and TCL programmers alike to set off one-shot timers after a certain number of seconds/minutes.
timer <minutes> <tcl-command>
executes the tcl command after a certain number of minutes have passed
returns: a timerIDutimer <seconds> <tcl-command>
executes the tcl command after a certain number of seconds have passed
returns: a timerIDtimers
returns: list of active minutely timers; each entry in the list contains the number of minutes left till activation, the command that will be executed, and the timerIDutimers
returns: list of active secondly timers, identical in format to the output from 'timers'killtimer <timerID>
removes a minutely timer from the list
returns: nothingkillutimer <timerID>
removes a secondly timer from the list
returns: nothing
TimerID timer_add ( TimerStack stack, int time, void (*call_back_function)(TimerID, char *), char * extra_info );
causes the call_back_function to be called with argument extra_info, after time units (depending on stack) have elapsed. This is a one-shot timer system.
NOTE: extra_info must be a string, a copy is kept by the timer module.
returns: the integer ID of the timer. -1 on error.int timer_del ( TimerStack stack, TimerID ID );
causes a running timer (id ID) to cease to exist.
returns: 1 on success, 0 on failureint timer_running ( TimerStack stack, TimerID ID );
returns: 0 if the timer ISNT running, 1 if it is, -1 if an error occurs.Your callback function:
void cbf ( TimerID id, char * extra );
this is called when the timer expires, id being the timer id, extra being the string you passed it originally
Feed these to the above functions for TimerStack, anything else will cause the functions to fail.TIMERSTACK_SECONDSsecondly times, add times to this stack to specify them running after a certain number of seconds.TIMERSTACK_MINUTESminutely timers, timers on this stack are run the specified number of minutes after the timer starts (on the minute)