harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stepan Mishura (JIRA)" <j...@apache.org>
Subject [jira] Closed: (HARMONY-498) GregorianCalendar clone problem
Date Fri, 26 May 2006 11:39:30 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-498?page=all ]
     
Stepan Mishura closed HARMONY-498:
----------------------------------


Verified by Mark.

> GregorianCalendar clone problem
> -------------------------------
>
>          Key: HARMONY-498
>          URL: http://issues.apache.org/jira/browse/HARMONY-498
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Mark Hindess
>     Assignee: Stepan Mishura
>     Priority: Minor

>
> The following test code breaks on Harmony.  Setting milliseconds to zero alters the day
of the month.  Output on RI is:
> today time = Tue May 23 14:06:51 BST 2006
> yesterday time = Mon May 22 14:06:51 BST 2006
> day of month before resetting milliseconds = 23
> day of month  after resetting milliseconds = 23
> time before resetting seconds = Tue May 23 14:06:51 BST 2006
> time  after resetting seconds = Tue May 23 14:06:00 BST 2006
> Output on Harmony is:
> today time = Tue May 23 13:59:39 BST 2006
> yesterday time = Mon May 22 13:59:39 BST 2006
> day of month before resetting milliseconds = 23
> day of month  after resetting milliseconds = 22
> time before resetting seconds = Tue May 23 13:59:39 BST 2006
> time  after resetting seconds = Mon May 22 13:59:00 BST 2006
> I suspect it might have something to do with the cachedFields?
> import java.util.TimeZone;
> import java.util.Calendar;
> public class Test2 {
>     public static void main(String[] args) {
>         Calendar today = Calendar.getInstance();
>         System.err.println("today time = "+today.getTime());
>         Calendar yesterday = (Calendar)today.clone(); // copy not deep enough?
>         yesterday.add(Calendar.DATE, -1);
>         System.err.println("yesterday time = "+yesterday.getTime());
>         Calendar broken = (Calendar)today.clone();
>         System.err.println("day of month before resetting milliseconds = "+
>                            broken.get(Calendar.DAY_OF_MONTH));
>         broken.set(Calendar.MILLISECOND, 0);
>         System.err.println("day of month  after resetting milliseconds = "+
>                            broken.get(Calendar.DAY_OF_MONTH));
>         System.err.println("time before resetting seconds = "+broken.getTime());
>         broken.set(Calendar.SECOND, 0);
>         System.err.println("time  after resetting seconds = "+broken.getTime());
>     }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message