[ 
https://issues.apache.org/jira/browse/LANG-982?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benedikt Ritter closed LANG-982.
--------------------------------


> DurationFormatUtils.formatDuration(61999, "s.SSSS") - ms field size should be 
> 4 digits
> --------------------------------------------------------------------------------------
>
>                 Key: LANG-982
>                 URL: https://issues.apache.org/jira/browse/LANG-982
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.time.*
>            Reporter: Sebb
>             Fix For: 3.3.1
>
>
> DurationFormatUtils.formatDuration(61999, "s.SSSS")  generates the wrong 
> number of places for the millisecond field. It should produce 61.0999 but it 
> generates 61.999.
> This is an unlikely format, but there is no indication that the millisecond 
> field is a maximum of 3 digits when it happens to follow a seconds field.
> This issue occurs because of the way the code attempts to ensure that 3 
> places are shown in a format if milliseconds follows seconds.
> The code currently adds 1000 and then drops the first digit.
> The simplest way to allow an arbitrary number of digits is to use at least 3 
> for the count field.
> Alternatively, if exactly 3 digits are required it would be simpler to just 
> use a count of 3.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to