--- libaitsched/src/tasks.c 2011/10/04 12:34:33 1.2 +++ libaitsched/src/tasks.c 2011/10/04 20:12:01 1.2.2.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: tasks.c,v 1.2 2011/10/04 12:34:33 misho Exp $ +* $Id: tasks.c,v 1.2.2.1 2011/10/04 20:12:01 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -157,11 +157,11 @@ schedWrite(sched_root_task_t * __restrict root, sched_ * @root = root task * @func = task execution function * @arg = 1st func argument - * @ms = arguments in microSecs, define period 1sec == 1000000 + * @tv = timeout argument structure * return: NULL error or !=NULL new queued task */ sched_task_t * -schedTimer(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg, u_int ms) +schedTimer(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg, struct timeval tv) { sched_task_t *task, *t = NULL; void *ptr; @@ -192,8 +192,8 @@ schedTimer(sched_root_task_t * __restrict root, sched_ /* calculate timeval structure */ clock_gettime(CLOCK_MONOTONIC, &nw); - now.tv_sec = nw.tv_sec + ms / 1000000; - now.tv_usec = nw.tv_nsec / 1000 + (ms % 1000000); + now.tv_sec = nw.tv_sec + tv.tv_sec; + now.tv_usec = nw.tv_nsec / 1000 + tv.tv_usec; if (now.tv_usec >= 1000000) { now.tv_sec++; now.tv_usec -= 1000000;