use strict;
use warnings;
-use POSIX qw(strftime);
-use PVE::JSONSchema;
+use POSIX qw(strftime round);
use base 'Exporter';
our @EXPORT_OK = qw(
my ($duration_in_seconds) = @_;
my $text = '';
- my $rest = $duration_in_seconds;
+ my $rest = round($duration_in_seconds // 0);
+
+ return "0s" if !$rest;
my $step = sub {
my ($unit, $unitlength) = @_;
sub render_bytes {
my ($value, $precision) = @_;
+ $precision = $precision->{precision} if ref($precision) eq 'HASH';
+
my @units = qw(B KiB MiB GiB TiB PiB);
my $max_unit = 0;