diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/alarm.c | 6 |
2 files changed, 4 insertions, 3 deletions
@@ -42,6 +42,7 @@ o wake up the daemon iff there are real events to handle instead of polling o add support for tagged vlan interfaces in the config file, e.g. eth0.1 o improve alarm framework based on suggestions from Max Kellerman o constify queue_iterate() +o use timeradd() since manipulating tv_sec directly Max Kellermann <max@duempel.org>: diff --git a/src/alarm.c b/src/alarm.c index 6edf68e..16e7a14 100644 --- a/src/alarm.c +++ b/src/alarm.c @@ -54,7 +54,7 @@ void add_alarm(struct alarm_list *alarm) struct timeval tv; gettimeofday(&tv, NULL); - alarm->tv.tv_sec += tv.tv_sec; + timeradd(&alarm->tv, &tv, &alarm->tv); __add_alarm(alarm); } @@ -68,9 +68,9 @@ void mod_alarm(struct alarm_list *alarm, unsigned long sc, unsigned long usc) struct timeval tv; list_del(&alarm->head); + set_alarm_expiration(alarm, sc, usc); gettimeofday(&tv, NULL); - alarm->tv.tv_sec = tv.tv_sec + sc; - alarm->tv.tv_usec = usc; + timeradd(&alarm->tv, &tv, &alarm->tv); __add_alarm(alarm); } |