This is the mail archive of the java-prs@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libgcj/17002] java.util.TimeZone.getDefault() is broken


------- Additional Comments From mckinlay at redhat dot com  2004-08-26 19:43 -------
Unfortunately, this isn't yet fixed for some platforms, such as Fedora Core 2. 

FC2 does not set the TZ environment variable, and it does not have an
/etc/timezone file. 

Here's the test case:

import java.util.TimeZone;

public class TZ2
{
  public static void main(String[] args)
  {
    TimeZone tz = TimeZone.getDefault();
    System.out.println (tz.getID());
  }
}

$ java TZ2
America/Toronto

$ gij TZ2
EST

I straced Sun's JVM to see if I could tell how it was getting the timezone ID:

open("/etc/sysconfig/clock", O_RDONLY)  = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=42, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xea75d000
read(4, "ZONE=\"America/Toronto\"\nUTC=true\n"..., 4096) = 42
close(4)                                = 0

Looks like we need to try the /etc/sysconfig/clock file also?


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17002


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]