Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 20197 invoked from network); 2 Feb 2011 21:55:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Feb 2011 21:55:38 -0000 Received: (qmail 64712 invoked by uid 500); 2 Feb 2011 21:55:38 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 64608 invoked by uid 500); 2 Feb 2011 21:55:37 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 64601 invoked by uid 99); 2 Feb 2011 21:55:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Feb 2011 21:55:37 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Feb 2011 21:55:36 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 350372388A38; Wed, 2 Feb 2011 21:55:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1066645 - in /commons/proper/lang/trunk/src: main/java/org/apache/commons/lang3/time/DateUtils.java test/java/org/apache/commons/lang3/time/DateUtilsTest.java Date: Wed, 02 Feb 2011 21:55:16 -0000 To: commits@commons.apache.org From: niallp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110202215516.350372388A38@eris.apache.org> Author: niallp Date: Wed Feb 2 21:55:15 2011 New Revision: 1066645 URL: http://svn.apache.org/viewvc?rev=1066645&view=rev Log: LANG-677 DateUtils isSameLocalTime() compares the hour using 12hour Calendar.HOUR instead of 24hour Calendar.HOUR_OF_DAY - thanks to Christian Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java?rev=1066645&r1=1066644&r2=1066645&view=diff ============================================================================== --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java Wed Feb 2 21:55:15 2011 @@ -262,7 +262,7 @@ public class DateUtils { return (cal1.get(Calendar.MILLISECOND) == cal2.get(Calendar.MILLISECOND) && cal1.get(Calendar.SECOND) == cal2.get(Calendar.SECOND) && cal1.get(Calendar.MINUTE) == cal2.get(Calendar.MINUTE) && - cal1.get(Calendar.HOUR) == cal2.get(Calendar.HOUR) && + cal1.get(Calendar.HOUR_OF_DAY) == cal2.get(Calendar.HOUR_OF_DAY) && cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR) && cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java?rev=1066645&r1=1066644&r2=1066645&view=diff ============================================================================== --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java Wed Feb 2 21:55:15 2011 @@ -227,6 +227,14 @@ public class DateUtilsTest extends TestC cal2.set(2004, 6, 9, 13, 45, 0); cal2.set(Calendar.MILLISECOND, 0); assertEquals(true, DateUtils.isSameLocalTime(cal1, cal2)); + + Calendar cal3 = Calendar.getInstance(); + Calendar cal4 = Calendar.getInstance(); + cal3.set(2004, 6, 9, 4, 0, 0); + cal4.set(2004, 6, 9, 16, 0, 0); + cal3.set(Calendar.MILLISECOND, 0); + cal4.set(Calendar.MILLISECOND, 0); + assertFalse("LANG-677", DateUtils.isSameLocalTime(cal3, cal4)); cal2.set(2004, 6, 9, 11, 45, 0); assertEquals(false, DateUtils.isSameLocalTime(cal1, cal2));