From bd0e66e7eaea6efd5d96f7b54c616561cc0b4b2d Mon Sep 17 00:00:00 2001 From: eric Date: Thu, 5 Aug 2004 21:16:24 +0000 Subject: [PATCH] Fix up the zeroTime() function. Calendar has two unique fields that store hour data for some reason, which are both set when one does Calendar.getInstance(), so we need to change both of them if we actually want the hour to change. Also change to explicitly set the fields to zero, since clear isn't setting them to zero but to 'undefined' which happens to be interpreted as zero. Might as well be explicit about what we want. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1476 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../src/java/com/samskivert/util/CalendarUtil.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/projects/samskivert/src/java/com/samskivert/util/CalendarUtil.java b/projects/samskivert/src/java/com/samskivert/util/CalendarUtil.java index 2dcb03a9..0212181f 100644 --- a/projects/samskivert/src/java/com/samskivert/util/CalendarUtil.java +++ b/projects/samskivert/src/java/com/samskivert/util/CalendarUtil.java @@ -15,10 +15,11 @@ public class CalendarUtil */ public static void zeroTime (Calendar cal) { - cal.clear(Calendar.HOUR); - cal.clear(Calendar.MINUTE); - cal.clear(Calendar.SECOND); - cal.clear(Calendar.MILLISECOND); + cal.set(Calendar.HOUR, 0); + cal.set(Calendar.HOUR_OF_DAY, 0); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); } /**