This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
<patch> avoid division by 0 in Benchmark.pm
[perl5.git] / lib / Benchmark.pm
index 487ddd5..7cb78eb 100644 (file)
@@ -435,7 +435,7 @@ sub timestr {
                            $r,$pu,$ps,$pt) if $style eq 'noc';
     $s=sprintf("%2d wallclock secs (%$f cusr + %$f csys = %$f CPU)",
                            $r,$cu,$cs,$ct) if $style eq 'nop';
-    $s .= sprintf(" @ %$f/s (n=$n)", $n / ( $pu + $ps )) if $n;
+    $s .= sprintf(" @ %$f/s (n=$n)", $n / ( $pu + $ps )) if $pu + $ps;
     $s;
 }