You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Jim Yu (JIRA)" <ji...@apache.org> on 2008/08/27 10:53:44 UTC

[jira] Commented: (HARMONY-5468) [classlib][util] java.util.Date.toString outputs real time zone name on RI, but prints GMT<+/-offset> on Harmony.

    [ https://issues.apache.org/jira/browse/HARMONY-5468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12626039#action_12626039 ] 

Jim Yu commented on HARMONY-5468:
---------------------------------

I took a look at this issue and found that we can remove the delegation to ICU since we only use the en-us locale here.  I think we can easily implement
this method instead of delegating to SimpleDateFormat. Then, this defect can be easily resolved. Moreover, invoking SimpleDateFormat  will lead to low performance
of this API. For a simple testcase as below [1], the original result is 119667 millisecs while the result after applying my patch is only 1140 millisecs. 
 Is there anyone to verify this patch?
[1] 
import java.util.Date;

public class DateToStringTest {

    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        Date date = new Date();
        long count = 100000;
        System.out.println(date.toString());
        while(--count != 0) {
              date.toString();
        }
        System.out.println(System.currentTimeMillis() - start);
    }
}

> [classlib][util] java.util.Date.toString outputs real time zone name on RI, but prints GMT<+/-offset> on Harmony.
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5468
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5468
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: All
>            Reporter: Pavel Pervov
>            Assignee: Tony Wu
>         Attachments: HARMONY-5468.diff
>
>
> The fllowing test demonstrates the behaviour:
> --------------------------
> import java.util.TimeZone;
> import java.util.Date;
> class DateToString {
>     public static void main(String[] args) {
>         TimeZone tz = TimeZone.getDefault();
>         tz.setDefault(tz.getTimeZone("MST"));
>         System.out.println(new Date(104, 2, 13));
>     }
> }
> --------------------------
> It looks like the problem may be in ICU's SimpleTimeZone pattern processing code.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.