I dont fully grasp what you are trying to do here. I?ve done similar things with a flag and a timestamp for each timer. To illustrate (from the top of my head..)
toggle quoted message
Show quoted text
integer timer_active[32]; // I normally use a bitfield, but this is easier long_integer timer_time[32]; long_integer timer_start[32]; function start_timer(integer idx, long_integer t) { ..timer_active[idx] = 1; ..timer_start[idx] = GetHSeconds(); ..timer_time[idx] = t; } function elapsed_time(integer idx) { ..if (timer_active[idx]) return(GetHSeconds()-timer_start[idx]); } Then somehow periodically schedule tests for your timers within acceptable resolution. I typically do this with a permanent task that loops with a delay(), but you might as well use wait(). The code might look something like for (i = 1 to 32) ..if (timer_active[i] && elapsed_time(i) > timer_time[i]) ....<whatever> You can use dynamic arrays and scale for as many events as you need at runtime. cheers, -noob --- In Crestron@..., Heath Volmer <hvolmer@...> wrote:
|