From 323db724551f2e1908aa0341a5d2b6e03ce351ae Mon Sep 17 00:00:00 2001 From: cbdev Date: Sun, 25 Mar 2018 15:13:23 +0200 Subject: Actually fix interval calculation (Fixes #7) --- backend.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'backend.c') diff --git a/backend.c b/backend.c index 38abc7f..881f9b7 100644 --- a/backend.c +++ b/backend.c @@ -212,9 +212,11 @@ struct timeval backend_timeout(){ for(u = 0; u < nbackends; u++){ if(backends[u].interval){ res = backends[u].interval(); - if((res / 1000) <= secs){ + if((res / 1000) < secs){ secs = res / 1000; - if((res % 1000) < msecs){ + msecs = res % 1000; + } + else if(res / 1000 == secs && (res % 1000) < msecs){ msecs = res % 1000; } } -- cgit v1.2.3