2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +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();
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;
}