1 #include "libautomation.h"
3 void atm_call_in(ev_tstamp seconds
, void *f
) {
4 ev_once(EV_A_
-1, 0, seconds
, f
, NULL
);
7 void atm_task_cb(EV_P_ ev_timer
*w
, int revents
) {
8 struct ATM_TASK
*task
= (struct ATM_TASK
*) w
;
12 atm_time
= atm_timestamp();
14 ret
= task
->dsgrp
.policy(&task
->dsgrp
);
16 ev_timer_stop(EV_A_ w
);
17 ev_timer_set(w
, ret
* ATM_TIMER_RES
, w
->repeat
);
18 ev_timer_start(EV_A_ w
);
26 void atm_task_init(struct ATM_TASK
*task
, ev_tstamp interval
) {
27 ev_timer_init(&task
->watcher
, atm_task_cb
, 0.1, interval
);
28 atm_dsgrp_init(&task
->dsgrp
);
29 task
->task
= atm_do_nothing
;