diff options
Diffstat (limited to 'src/alarm.c')
-rw-r--r-- | src/alarm.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/alarm.c b/src/alarm.c index 13a790e..2190bb6 100644 --- a/src/alarm.c +++ b/src/alarm.c @@ -52,10 +52,13 @@ __add_alarm(struct alarm_list *alarm) list_add_tail(&alarm->head, &alarm_hash[i]); } -void add_alarm(struct alarm_list *alarm) +void add_alarm(struct alarm_list *alarm, unsigned long sc, unsigned long usc) { struct timeval tv; + del_alarm(alarm); + alarm->tv.tv_sec = sc; + alarm->tv.tv_usec = usc; gettimeofday(&tv, NULL); timeradd(&alarm->tv, &tv, &alarm->tv); __add_alarm(alarm); @@ -71,17 +74,6 @@ void del_alarm(struct alarm_list *alarm) } } -void mod_alarm(struct alarm_list *alarm, unsigned long sc, unsigned long usc) -{ - struct timeval tv; - - set_alarm_expiration(alarm, sc, usc); - gettimeofday(&tv, NULL); - timeradd(&alarm->tv, &tv, &alarm->tv); - list_del(&alarm->head); - __add_alarm(alarm); -} - static int calculate_next_run(struct timeval *cand, struct timeval *tv, |