adjust_timer—adjust timers on an event


The syntax for adjust_timer is as follows:

adjust_timers($OBJECT,$ADJUST,$TIMER)
adjust_timers($OBJECT,$ADJUST)

adjust_timers arguments

Argument

Mode

Type

Description

$OBJECT

Input

OBJECT

Specifies the object handle

$ADJUST

Input

INTEGES

Specifies the timer duration adjustment

$TIMER

Input

STRING

Specifies the information corresponding to the timer rule associated with .
If $TIMER is not specified, all timers are adjusted from $OBJECT associated with any timer rule.

Use the adjust_timers to adjust all timers on an event with handle $OBJECT associated with the timer rule with information $TIMER. If $TIMER is not specified, all timers are adjusted for an event with handle $OBJECT associated with any timer rule.

The timer expiration time is adjusted by the number of seconds specified by $ADJUST. A positive value for $ADJUST increases the amount of time it takes for the timer to expire. A negative value decreases the amount of time it takes for the timer to expire. If the negative $ADJUST value is greater than the time it would take for the timer to expire, then the timer will expire immediately.

adjust_timers example - rule to trigger a timer adjustment after a specified event is received

When you set up the following rule:

new test_timer : EVENT($E) where [$E.mc_tool==settmr]
  triggers
   {
     set_timer($E,$E.mc_tool_time,$E.mc_tool_rule);
   }
END

new adjust_timer : EVENT($E) where  [$E.mc_tool==adjtmr]
  using { EVENT($O) where [$O.mc_ueid == $E.mc_tool_id] }
  triggers
   {
     adjust_timers($O,$E.mc_tool_time);
   }
END

timer test_timer_0 : EVENT($E)
  timer_info: != ''
   {
     $E.msg = 'timer expired';
   }
END

then send following events, one after the other without waiting

mposter -n mcdev -a EVENT -b
'mc_ueid=evt001;mc_tool=settmr;mc_tool_rule=tmr1;mc_tool_time=120'
mposter -n mcdev -a EVENT -b
'mc_tool=adjtmr;mc_tool_id=evt001;mc_tool_time=-80'

The first event causes a timer on it to expire after 120 seconds. The second event causes that timer to be adjusted to expire after 40 seconds (subtracting 80).

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*