From 40cd885cfff5dde085b8c5af06807ce4c7bd0989 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 19 Aug 2020 21:59:22 +0100 Subject: [PATCH 1/1] expire-8601: wip new version, err on other side Signed-off-by: Ian Jackson --- scripts/expire-iso8601.new | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/expire-iso8601.new b/scripts/expire-iso8601.new index 169961a..b8a857e 100755 --- a/scripts/expire-iso8601.new +++ b/scripts/expire-iso8601.new @@ -106,12 +106,12 @@ sub flag ($) { my ($int) = @_; my $n = $int->{N}; my $d = $int->{D}; - my $dmin = $d - $slop; + my $dmax = $d + $slop; 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 (;;) { @@ -126,14 +126,14 @@ sub flag ($) { 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--; - 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; } last if $j < 0; -- 2.30.2