]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix > vs >= bug
authorAlan T. DeKok <aland@freeradius.org>
Tue, 21 Jun 2011 07:06:38 +0000 (09:06 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 21 Jun 2011 07:06:38 +0000 (09:06 +0200)
src/lib/event.c

index ab937a546b23325625f67ed7aaba6b185645f586..515654599aa668fc1054ed162b513b5df4b9f2a1 100644 (file)
@@ -155,7 +155,7 @@ int fr_event_insert(fr_event_list_t *el,
 {
        fr_event_t *ev;
 
-       if (!el || !callback | !when || (when->tv_usec > USEC)) return 0;
+       if (!el || !callback | !when || (when->tv_usec >= USEC)) return 0;
 
        if (ev_p && *ev_p) fr_event_delete(el, ev_p);
 
@@ -364,9 +364,11 @@ int fr_event_loop(fr_event_list_t *el)
                                if (when.tv_sec > 0) {
                                        when.tv_sec--;
                                        when.tv_usec += USEC;
+                               } else {
+                                       when.tv_sec = 0;
                                }
                                when.tv_usec -= el->now.tv_usec;
-                               if (when.tv_usec > USEC) {
+                               if (when.tv_usec >= USEC) {
                                        when.tv_usec -= USEC;
                                        when.tv_sec++;
                                }