# HG changeset patch # User Matti Hamalainen # Date 1351005951 -10800 # Node ID 1c5174dcd92ac63c02ecf4d121adea34ae1219ac # Parent b2f45dd616bcd7be81d05598d19fa41a94e924eb Clean up maxDays computation. diff -r b2f45dd616bc -r 1c5174dcd92a parsedata.pl --- a/parsedata.pl Tue Oct 23 18:04:15 2012 +0300 +++ b/parsedata.pl Tue Oct 23 18:25:51 2012 +0300 @@ -274,7 +274,7 @@ my $q = $$node{"nodes"}; my $hourDefs = {}; my $hourTable = {}; -my $maxDays = 6; +my $maxDays = 0; my $maxHours = 0; # Skip zero position this way (can't use foreach here) @@ -311,9 +311,10 @@ } my $cday = 0; - for (my $x = 0; $x < $maxDays; $x++) { + for (my $x = 0; $x < 7; $x++) { if (!defined($$hourTable{$maxHours}{$x})) { $cday = $x; + $maxDays = $x if ($x > $maxDays); last; } } @@ -342,15 +343,6 @@ $maxHours-- if ($flag); } -$flag = 1; -for (my $x = $maxDays - 1; $x >= 0 && $flag; $x--) { - for (my $y = 0; $y < $maxHours && $flag; $y++) { - $flag = 0 if (defined($$hourTable{$y}{$x}) && $$hourTable{$y}{$x} != 0); - } - $maxDays-- if ($flag); -} - - ### Open output file, if specified if (defined($opt_outfile)) { open(STDOUT, '>', $opt_outfile) or die("Could not open output file '$opt_outfile'.\n");