public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libgcj/7789: java.util.TimeZone.getDefault() finds wrong time zone
@ 2002-08-31  6:55 jmr
  0 siblings, 0 replies; only message in thread
From: jmr @ 2002-08-31  6:55 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7789
>Category:       libgcj
>Synopsis:       java.util.TimeZone.getDefault() finds wrong time zone
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 31 01:06:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Jesse Rosenstock
>Release:        3.3 20020828 (experimental)
>Organization:
>Environment:
System: Linux churchill 2.4.3-12 #1 Fri Jun 8 15:05:56 EDT 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --prefix=/home/user/jmr/app/gcc --enable-langs=c++,java --enable-shared --enable-threads=posix --with-as=/home/user/jmr/app/binutils/bin/as --with-ld=/home/user/jmr/app/binutils/bin/ld : (reconfigured) 
>Description:
	java.util.TimeZone.getDefault() is finding a timezone with the
        same offset from GMT, but one that doesn't use DST.  This causes
        new Date().toString() to return a time that is off by one hour.

        I'm in Pacific time.  In natTimeZone.cc, getSystemTimeZone() 
        is returning "PDT8".  It's using the HAVE_TM_ZONE code.  I tried
        switching the order of ifdefs around so that HAVE_TZNAME would
        be checked first, however my system isn't being detected has
        having tzname even though it does.  Fixing that detection would
        be one fix and swapping the order of checking would be one fix.
        Perhaps someone had a reason to avoid using tzname, though.

        TimeZone.getDefaultTimeZoneId calls TimeZone.getTimeZone()
        on the string returned by getSystemTimeZone, so another
        possible fix is to add a PDT8 entry (and many others)
        to the initialization in TimeZone's static initializer block.
>How-To-Repeat:
; cat TimeZoneTest.java
import java.util.Date;
import java.util.TimeZone;

public class TimeZoneTest {
    public static void main(String[] args) {
        TimeZone tz = TimeZone.getDefault();

        System.out.println(tz.getID());
        System.out.println(tz.getDSTSavings());
        System.out.println(tz.getRawOffset());
        System.out.println(tz.inDaylightTime(new Date()));
        System.out.println(tz.useDaylightTime());
    }
}

; javac TimeZoneTest.java
; java TimeZoneTest
America/Los_Angeles
3600000
-28800000
true
true

; gij TimeZoneTest
Pacific/Pitcairn
3600000
-28800000
false
false

>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-08-31  8:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-31  6:55 libgcj/7789: java.util.TimeZone.getDefault() finds wrong time zone jmr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).