mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
98_apptime:improve nice calculation
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@19468 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
deb0d9a06a
commit
29868d57c7
@ -23,7 +23,6 @@ use vars qw(%prioQueues);
|
|||||||
sub apptime_getTiming($$$@);
|
sub apptime_getTiming($$$@);
|
||||||
sub apptime_Initialize($);
|
sub apptime_Initialize($);
|
||||||
|
|
||||||
use constant DEBUG_OUTPUT_INTATA => 0;
|
|
||||||
|
|
||||||
my $apptimeStatus;
|
my $apptimeStatus;
|
||||||
|
|
||||||
@ -46,32 +45,6 @@ my $totCnt = 0;
|
|||||||
sub HandleTimeout() {
|
sub HandleTimeout() {
|
||||||
return undef if(!$nextat);
|
return undef if(!$nextat);
|
||||||
|
|
||||||
if (DEBUG_OUTPUT_INTATA) {
|
|
||||||
my $ms = 0;
|
|
||||||
my $n = int(@intAtA);
|
|
||||||
my $j;
|
|
||||||
for ($j=0; $j < ($n-1); $j++) {
|
|
||||||
if (!defined($intAtA[$j])) {
|
|
||||||
Log 0, "Error in intAtA, undefined element $j/$n\n";
|
|
||||||
}
|
|
||||||
elsif (!defined($intAtA[$j]->{TRIGGERTIME})) {
|
|
||||||
Log 0, "Error in intAtA, undefined tim $j/$n\n";
|
|
||||||
}
|
|
||||||
next if ($intAtA[$j]->{TRIGGERTIME} <= $intAtA[$j+1]->{TRIGGERTIME});
|
|
||||||
if (!$ms) {
|
|
||||||
Log 0, "Error in intAtA, sortErr $j/$n\n";
|
|
||||||
$ms = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$j = $n-1;
|
|
||||||
if (!defined($intAtA[$j])) {
|
|
||||||
Log 0, "Error in intAtA, undefined element $j/$n\n";
|
|
||||||
}
|
|
||||||
elsif (!defined($intAtA[$j]->{TRIGGERTIME})) {
|
|
||||||
Log 0, "Error in intAtA, undefined tim $j/$n\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
my $now = gettimeofday();
|
my $now = gettimeofday();
|
||||||
if($now < $nextat) {
|
if($now < $nextat) {
|
||||||
$selectTimestamp = $now;
|
$selectTimestamp = $now;
|
||||||
@ -106,7 +79,7 @@ sub HandleTimeout() {
|
|||||||
$fnname = $cv->GV->NAME;
|
$fnname = $cv->GV->NAME;
|
||||||
}
|
}
|
||||||
$arg = $at->{ARG};
|
$arg = $at->{ARG};
|
||||||
$shortarg = (defined($arg)?$arg:"");
|
$shortarg = (defined($arg)?$arg:"_");
|
||||||
$shortarg = "HASH_unnamed" if ( (ref($shortarg) eq "HASH")
|
$shortarg = "HASH_unnamed" if ( (ref($shortarg) eq "HASH")
|
||||||
&& !defined($shortarg->{NAME}) );
|
&& !defined($shortarg->{NAME}) );
|
||||||
($shortarg,undef) = split(/:|;/,$shortarg,2); # for special long args with delim ;
|
($shortarg,undef) = split(/:|;/,$shortarg,2); # for special long args with delim ;
|
||||||
@ -120,7 +93,7 @@ sub HandleTimeout() {
|
|||||||
$now = gettimeofday();
|
$now = gettimeofday();
|
||||||
|
|
||||||
if(%prioQueues) {
|
if(%prioQueues) {
|
||||||
my $nice = minNum(keys %prioQueues);
|
my $nice = minNum(19,keys %prioQueues);
|
||||||
my $entry = shift(@{$prioQueues{$nice}});
|
my $entry = shift(@{$prioQueues{$nice}});
|
||||||
delete $prioQueues{$nice} if(!@{$prioQueues{$nice}});
|
delete $prioQueues{$nice} if(!@{$prioQueues{$nice}});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user