From 6bcfbab4545af5cba17f8b3f4cf82626b4d5b0c2 Mon Sep 17 00:00:00 2001 From: martinp876 <> Date: Thu, 6 Dec 2012 20:44:21 +0000 Subject: [PATCH] bug in timer calculation git-svn-id: https://svn.fhem.de/fhem/trunk@2271 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/fhem.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fhem/fhem.pl b/fhem/fhem.pl index 76814851c..fab40c091 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -1921,6 +1921,7 @@ HandleTimeout() my $now = gettimeofday(); return ($nextat-$now) if($now < $nextat); + $now += 0.01;# need to cover min delay at least $nextat = 0; ############# # Check the internal list. @@ -1936,13 +1937,15 @@ HandleTimeout() &{$fn}($intAt{$i}{ARG}); use strict "refs"; delete($intAt{$i}); - } - $nextat = $tim if(!$nextat || $nextat > $tim); + } else { + $nextat = $tim if(!$nextat || $nextat > $tim); + } } return undef if(!$nextat); - $now = gettimeofday(); - return ($now < $nextat) ? ($nextat-$now) : 0; + $now = gettimeofday(); # possibly some tasks did timeout in the meantime + # we will cover them + return ($now+ 0.01 < $nextat) ? ($nextat-$now) : 0.01; }