GregorianCalendar about 15 days off in sablevm-classpath-1.11.3

"Galmes, jose" <[email protected]> Tue, 17 May 2005 10:29:35 +0200
Newsgroups gmane.comp.java.vm.sablevm.devel
Message-ID <B9C4EB5459374D4DA513988E2891EC9602856378@bcnexc02.emea.cpqcorp.net>
Hi,

I'm running into problems withs dates in
sablevm-classpath-1.11.3, which the following simple test
program illustrates:

---
import java.util.*;
import java.text.*;

public class DateTest {
    public static void main(String args[]) {
        Date d;

        if (args.length == 0) {
            d = new Date();
        } else {
            d = new Date(Long.parseLong(args[0]));
        }
        
        DateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", 
                                             Locale.US);
        String     ds = df.format(d);

        System.out.println(ds);
    }
}
---

If you run:

   % java-sablevm DateTest; date
   Tue, 02 May 2005 11:17:16 GMT+02:00
   Tue May 17 11:17:18 CEST 2005

If you run:

   % java-sablevm DateTest 0
   java.lang.IllegalArgumentException: day out of range
      at java.util.SimpleTimeZone.getOffset (SimpleTimeZone.java:681)
      at java.util.GregorianCalendar.computeFields (GregorianCalendar.java:828)
      at java.util.Calendar.complete (Calendar.java:906)
      at java.util.Calendar.get (Calendar.java:666)
      at java.text.SimpleDateFormat.formatWithAttribute(SimpleDateFormat.java:728)   
      at java.text.SimpleDateFormat.format (SimpleDateFormat.java:804)
      at java.text.DateFormat.format (DateFormat.java:473)
      at DateTest.main (DateTest.java:16)
      at java.lang.VirtualMachine.invokeMain (VirtualMachine.java)
      at java.lang.VirtualMachine.main (VirtualMachine.java:108)

If you run:

   % java-sablevm DateTest 1292400000
   Fri, 01 Jan 1970 00:00:00 GMT+01:00

That is, the epoch doesn't correspond to 0 (zero), but to
1292400 seconds (about 15 days), which is also about the 
same offset that shows the current date.

Is this a known bug?

Thanks,

Jose "Pepe" Galmes