Mercurial > hg > lukkari
changeset 53:1c5174dcd92a
Clean up maxDays computation.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 23 Oct 2012 18:25:51 +0300 |
parents | b2f45dd616bc |
children | 656b2a22b945 |
files | parsedata.pl |
diffstat | 1 files changed, 3 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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");