commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang/time DurationFormatUtils.java
Date Sun, 29 Aug 2004 03:42:48 GMT
bayard      2004/08/28 20:42:48

  Modified:    lang/src/java/org/apache/commons/lang/time
                        DurationFormatUtils.java
  Log:
  fix to handle the tiny difference between YEAR and 12*MONTH
  
  Revision  Changes    Path
  1.12      +6 -1      jakarta-commons/lang/src/java/org/apache/commons/lang/time/DurationFormatUtils.java
  
  Index: DurationFormatUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/time/DurationFormatUtils.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DurationFormatUtils.java	27 Aug 2004 06:45:25 -0000	1.11
  +++ DurationFormatUtils.java	29 Aug 2004 03:42:48 -0000	1.12
  @@ -118,6 +118,11 @@
           if(Token.containsTokenWithValue(tokens, M) ) {
               months = (int) (millis / DateUtils.MILLIS_PER_MONTH);
               millis = millis - (months * DateUtils.MILLIS_PER_MONTH);
  +            // as MONTH * 12 != YEAR, this fixes issues
  +            if(months == 12) {
  +                years++;
  +                months = 0;
  +            }
           }
           if(Token.containsTokenWithValue(tokens, d) ) {
               days = (int) (millis / DateUtils.MILLIS_PER_DAY);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message