if ($values{'qa_contact'}) {
$values{'qa_contact'} = DBID_to_name($values{'qa_contact'});
}
- $values{'estimated_time'} = FormatTimeUnit($values{'estimated_time'});
+ $values{'estimated_time'} = format_time_decimal($values{'estimated_time'});
my @dependslist;
SendSQL("SELECT dependson FROM dependencies WHERE
$what =~ s/^(Attachment )?/Attachment #$attachid / if $attachid;
if( $fieldname eq 'estimated_time' ||
$fieldname eq 'remaining_time' ) {
- $old = FormatTimeUnit($old);
- $new = FormatTimeUnit($new);
+ $old = format_time_decimal($old);
+ $new = format_time_decimal($new);
}
if ($attachid) {
SendSQL("SELECT isprivate FROM attachments
html_quote url_quote value_quote xml_quote
css_class_quote
lsearch max min
- trim diff_strings format_time);
+ trim diff_strings
+ format_time format_time_decimal);
use Bugzilla::Config;
return $time;
}
+sub format_time_decimal {
+ my ($time) = (@_);
+
+ my $newtime = sprintf("%.2f", $time);
+
+ if ($newtime =~ /0\Z/) {
+ $newtime = sprintf("%.1f", $time);
+ }
+
+ return $newtime;
+}
+
1;
__END__
timezone to display times in. In the future, it may also allow for the time to be
shown in different formats.
+=item C<format_time_decimal($time)>
+
+Returns a number with 2 digit precision, unless the last digit is a 0. Then it
+returns only 1 digit precision.
+
+
=back
return $str;
}
-sub FormatTimeUnit {
- # Returns a number with 2 digit precision, unless the last digit is a 0
- # then it returns only 1 digit precision
- my ($time) = (@_);
-
- my $newtime = sprintf("%.2f", $time);
-
- if ($newtime =~ /0\Z/) {
- $newtime = sprintf("%.1f", $time);
- }
-
- return $newtime;
-
-}
###############################################################################