From: Peter Edberg Date: Sun, 13 Jan 2013 19:11:07 +0000 (+0000) Subject: ICU-9781 Parsing fractional seconds should truncate (not round) to 3 places (J) X-Git-Tag: milestone-59-0-1~3221 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=df1a9a0469c6bc003357ccbbca0f6434b24e6e16;p=icu ICU-9781 Parsing fractional seconds should truncate (not round) to 3 places (J) X-SVN-Rev: 33045 --- diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java b/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java index 14a86ac9f70..15678b770fe 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java @@ -1,6 +1,6 @@ /* ******************************************************************************* - * Copyright (C) 1996-2012, International Business Machines Corporation and * + * Copyright (C) 1996-2013, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* */ @@ -2361,7 +2361,7 @@ public class SimpleDateFormat extends DateFormat { a *= 10; i--; } - value = (value + (a>>1)) / a; + value /= a; } cal.set(Calendar.MILLISECOND, value); return pos.getIndex(); diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java index a130ad75e18..0e35a4b03e8 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java @@ -544,7 +544,7 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk { "y/M/d H:mm:ss.S", "fp", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.5", "2004 03 10 16:36:31.500", "y/M/d H:mm:ss.SS", "fp", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.56", "2004 03 10 16:36:31.560", "y/M/d H:mm:ss.SSS", "F", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.567", - "y/M/d H:mm:ss.SSSS", "pf", "2004/3/10 16:36:31.5679", "2004 03 10 16:36:31.568", "2004/3/10 16:36:31.5680", + "y/M/d H:mm:ss.SSSS", "pf", "2004/3/10 16:36:31.5679", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.5670", }; expect(DATA, new Locale("en", "", "")); }