libgcj/7786: TimeZone.getDSTSavings() from JDK1.4 not implemented
jmr@ugcs.caltech.edu
jmr@ugcs.caltech.edu
Fri Aug 30 20:56:00 GMT 2002
>Number: 7786
>Category: libgcj
>Synopsis: TimeZone.getDSTSavings() from JDK1.4 not implemented
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Aug 30 20:56: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:
TimeZone.getDSTSavings() was added in JDK1.4 and isn't implemented.
>How-To-Repeat:
; cat DSTTest.java
import java.util.Date;
import java.util.TimeZone;
public class DSTTest extends TimeZone {
private final boolean useDST;
public DSTTest(boolean useDST) {
this.useDST = useDST;
}
public int getOffset
(int era, int year, int month,
int day, int dayOfWeek, int milliseconds) { throw new Error(); }
public int getRawOffset() { throw new Error(); }
public void setRawOffset(int offsetMillis) { throw new Error(); }
public boolean useDaylightTime() { return useDST; }
public boolean inDaylightTime(Date date) { throw new Error(); }
public static void main(String[] args) {
System.err.println(new DSTTest(true).getDSTSavings());
System.err.println(new DSTTest(false).getDSTSavings());
}
}
; javac DSTTest.java && java DSTTest
3600000
0
; gcj DSTTest.java --main=DSTTest
DSTTest.java: In class `DSTTest':
DSTTest.java: In method `DSTTest.main(java.lang.String[])':
DSTTest.java:21: error: Can't find method `getDSTSavings()' in type `DSTTest'.
System.err.println(new DSTTest(true).getDSTSavings());
^
DSTTest.java:22: error: Can't find method `getDSTSavings()' in type `DSTTest'.
System.err.println(new DSTTest(false).getDSTSavings());
^
2 errors
But after the below patch:
; gcj DSTTest.java --main=DSTTest && ./a.out
3600000
0
>Fix:
*** TimeZone.java 13 May 2002 20:10:36 -0000 1.14
--- TimeZone.java 31 Aug 2002 03:29:28 -0000
***************
*** 961,966 ****
--- 961,982 ----
public abstract boolean inDaylightTime(Date date);
/**
+ * Gets the daylight savings offset. This is a positive offset in
+ * milliseconds with respect to standard time. Typically this
+ * is one hour, but for some time zones this may be half an our.
+ * <p>The default implementation returns 3600000 milliseconds
+ * (one hour) if the time zone uses daylight savings time
+ * (as specified by {@link #useDaylightTime()}), otherwise
+ * it returns 0.
+ * @return the daylight savings offset in milliseconds.
+ * @since 1.4
+ */
+ public int getDSTSavings ()
+ {
+ return useDaylightTime () ? 3600000 : 0;
+ }
+
+ /**
* Gets the TimeZone for the given ID.
* @param ID the time zone identifier.
* @return The time zone for the identifier or GMT, if no such time
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list