From 4bf97c5f3237b9fc7a344e2bc9101539012963e9 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 19 Aug 2020 21:52:52 +0100 Subject: [PATCH] expire-8601: wip new version Signed-off-by: Ian Jackson --- scripts/expire-iso8601.new | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/expire-iso8601.new b/scripts/expire-iso8601.new index e586e26..f001b35 100755 --- a/scripts/expire-iso8601.new +++ b/scripts/expire-iso8601.new @@ -103,18 +103,19 @@ sub precomp () { sub flag ($) { my ($int) = @_; - my $n = $int->{Number}; - my $d = $int->{Interval}; + my $n = $int->{N}; + my $d = $int->{D}; + my $dmin = $d - $slop; my $spec = $int->{Spec}; my $start_age = ($n+1) * $d; my $i = 0; - print DEBUG "FLAG $spec\n"; + print DEBUG "FLAG $spec sa=$start_age dmin=$dmin\n"; # find $i, the youngest which is at least $number x $interval for (;;) { print DEBUG "i #$i $files[$i]{A}\n"; - last if $files[$i]{A} > $start_age; + last if $files[$i]{A} >= $start_age; if ($i == $#files) { print STDERR "insufficient for $spec\n"; } @@ -132,7 +133,7 @@ sub flag ($) { last if $files[$j]; my $dt = $files[$i]{A} - $files[$j]{A}; print DEBUG "j #$j $files[$j]{A} dt=$dt\n"; - last if $dt >= $d - $slop; + last if $dt >= $dmin; } last if $j < 0; -- 2.30.2