/** * events_timer_reset(cookie): * Reset the timer for which the cookie ${cookie} was returned by * events_timer_register to its initial value. */ int events_timer_reset(void * cookie) { struct timerrec * t = cookie; struct timeval tv; /* Compute the new timeout. */ if (monoclock_get(&tv)) goto err0; tv.tv_sec += t->tv_orig.tv_sec; if ((tv.tv_usec += t->tv_orig.tv_usec) >= 1000000) { tv.tv_usec -= 1000000; tv.tv_sec += 1; } /* Adjust the timer. */ timerqueue_increase(Q, t->cookie, &tv); /* Success! */ return (0); err0: /* Failure! */ return (-1); }
/** * events_timer_reset(cookie): * Reset the timer for which the cookie ${cookie} was returned by * events_timer_register to its initial value. */ int events_timer_reset(void * cookie) { struct timerrec * t = cookie; struct timeval tv; /* Compute the new timeout. */ if (gettimeout(&tv, &t->tv_orig)) goto err0; /* Adjust the timer. */ timerqueue_increase(Q, t->cookie, &tv); /* Success! */ return (0); err0: /* Failure! */ return (-1); }