Commit a1e84323 authored by Tails developers's avatar Tails developers

Import newer htpdate.

Changes:

98f0e03 Compute the median of the diffs more correctly.
parent 721ebd59
......@@ -293,6 +293,11 @@ sub adjustDate {
}
}
sub median {
my @a = sort {$a <=> $b} @_;
return ($a[$#a/2] + $a[@a/2]) / 2;
}
parseCommandLine();
message("Running htpdate.");
my @diffs = grep {
......@@ -307,6 +312,5 @@ my @diffs = grep {
threads->create(\&getPoolDateDiff, { urls => $_ })
} @pools
or error "No Date header could be received.";
my @sorted_diffs = sort @diffs;
adjustDate($sorted_diffs[int(@sorted_diffs / 2)]);
adjustDate(median(@diffs));
done;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment