summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2011-04-10 17:07:27 +0000
committerivan <ivan>2011-04-10 17:07:27 +0000
commit32df08b31fc8e3b01b5e1c4e7376d12242a1dbae (patch)
tree48338218369355f5c4cb1eac2e76dbf0f08ca8f3
parenta6c01d53707e855bd46be26513a04692803475e2 (diff)
fix rounding of minute-granularity CDRs, RT#12101
-rw-r--r--FS/FS/cdr.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm
index b7d78766e..65ca50b29 100644
--- a/FS/FS/cdr.pm
+++ b/FS/FS/cdr.pm
@@ -552,8 +552,7 @@ sub export_formats {
my $conf = new FS::Conf;
my $date_format = $conf->config('date_format') || '%m/%d/%Y';
- # This is now smarter, and shows the call duration in the
- # largest units that accurately reflect the granularity.
+ # call duration in the largest units that accurately reflect the granularity
my $duration_sub = sub {
my($cdr, %opt) = @_;
my $sec = $opt{seconds} || $cdr->billsec;
@@ -562,7 +561,9 @@ sub export_formats {
return '1 call';
}
elsif ( $opt{granularity} == 60 ) {#full minutes
- return sprintf("%.0fm",$sec/60);
+ my $min = int($sec/60);
+ $min++ if $sec%60;
+ return $min.'m';
}
else { #anything else
return sprintf("%dm %ds", $sec/60, $sec%60);