2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

bug in timer calculation

git-svn-id: https://svn.fhem.de/fhem/trunk@2271 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2012-12-06 20:44:21 +00:00
parent c61e85da4e
commit 6bcfbab454

View File

@ -1921,6 +1921,7 @@ HandleTimeout()
my $now = gettimeofday(); my $now = gettimeofday();
return ($nextat-$now) if($now < $nextat); return ($nextat-$now) if($now < $nextat);
$now += 0.01;# need to cover min delay at least
$nextat = 0; $nextat = 0;
############# #############
# Check the internal list. # Check the internal list.
@ -1936,13 +1937,15 @@ HandleTimeout()
&{$fn}($intAt{$i}{ARG}); &{$fn}($intAt{$i}{ARG});
use strict "refs"; use strict "refs";
delete($intAt{$i}); delete($intAt{$i});
} } else {
$nextat = $tim if(!$nextat || $nextat > $tim); $nextat = $tim if(!$nextat || $nextat > $tim);
}
} }
return undef if(!$nextat); return undef if(!$nextat);
$now = gettimeofday(); $now = gettimeofday(); # possibly some tasks did timeout in the meantime
return ($now < $nextat) ? ($nextat-$now) : 0; # we will cover them
return ($now+ 0.01 < $nextat) ? ($nextat-$now) : 0.01;
} }