Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
my ($int) = @_;
my $n = $int->{N};
my $d = $int->{D};
my ($int) = @_;
my $n = $int->{N};
my $d = $int->{D};
my $spec = $int->{Spec};
my $start_age = ($n+1) * $d;
my $i = 0;
my $spec = $int->{Spec};
my $start_age = ($n+1) * $d;
my $i = 0;
- print DEBUG "FLAG $spec sa=$start_age dmin=$dmin\n";
+ print DEBUG "FLAG $spec sa=$start_age dmax=$dmax\n";
# find $i, the youngest which is at least $number x $interval
for (;;) {
# find $i, the youngest which is at least $number x $interval
for (;;) {
for (;;) {
push @{ $files[$i]{U} }, $spec;
for (;;) {
push @{ $files[$i]{U} }, $spec;
- # find $j, the closest to $i which is at least $d-slop younger
+ # find $j, the closest to $i which is no more than $dmax younger
my $j = $i;
for (;;) {
$j--;
my $j = $i;
for (;;) {
$j--;
- last if $j < 0;
- my $dt = $files[$i]{A} - $files[$j]{A};
- print DEBUG "j #$j $files[$j]{A} dt=$dt\n";
- last if $dt >= $dmin;
+ last if $j <= 0;
+ my $ndt = $files[$i]{A} - $files[$j-1]{A};
+ print DEBUG "j #$j $files[$j]{A} ndt=$ndt\n";
+ last if $ndt > $dmax;