# it believes it is a bulleted list and leaves it alone.
$c->{'oneliner_bullets'} ||= 0;
-# What units we have available for converting diskspaces.
-# The threshold is at what level we switch to using that unit.
+# What units we have available for converting diskspaces. The order is
+# important, the largest unit should come first.
+#
+# Allowed keys:
+# unit - SI unit to use
+# threshold - Any value greater than threshold uses this unit
+# make_integer - Strip off anything after the decimal point
+# make_integer_threshold - Anything over this value will have the
+# decimal point removed if make_integer is set to 1. This test is applied
+# after the size has been converted, so the value should be in the 'new'
+# unit.
+#
my @size_thresholds = (
{
'unit' => 'TB',
'threshold' => 1024 * 1024,
'conversion' => 1024 * 1024,
+ 'make_integer' => 1,
+ 'make_integer_threshold' => 500,
},
{
'unit' => 'GB',
'threshold' => 50 * 1024, # 50GB seems like a good threshold.
'conversion' => 1024,
+ 'make_integer' => 1,
+ 'make_integer_threshold' => 500,
},
{
'unit' => 'MB',
$vars->{"si_$key"} =~ s/\.0//;
$vars->{"si_${key}_unit"} = $unit->{'unit'};
+ if ($unit->{'make_integer'} &&
+ (! defined $unit->{'make_integer_threshold'}
+ || $vars->{"si_$key"} > $unit->{'make_integer_threshold'})) {
+ $vars->{"si_$key"} =~ s/\.[0-9]+//;
+ }
+
last;
}
} else {