This is the mail archive of the java-patches@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]

Patch: java.util.Timezone


Hi list,


I wrote a little patch for java.util.Timezone. It adds a missing method that 
was added on JDK 1.4.

Please review and comment. Okay for commit ?


Michael
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2452
diff -u -b -B -r1.2452 ChangeLog
--- ChangeLog	17 Dec 2003 16:24:10 -0000	1.2452
+++ ChangeLog	17 Dec 2003 21:50:38 -0000
@@ -1,5 +1,9 @@
 2003-12-17  Michael Koch  <konqueror@gmx.de>
 
+	* java/util/TimeZone.java (getOffset): New method.
+
+2003-12-17  Michael Koch  <konqueror@gmx.de>
+
 	* libltdl/stamp-h.in: Removed, not used anymore.
 
 2003-12-16  Mohan Embar  <gnustuff@thisiscool.com>
Index: java/util/TimeZone.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/TimeZone.java,v
retrieving revision 1.16
diff -u -b -B -r1.16 TimeZone.java
--- java/util/TimeZone.java	18 Sep 2003 06:34:00 -0000	1.16
+++ java/util/TimeZone.java	17 Dec 2003 21:50:38 -0000
@@ -1,5 +1,6 @@
 /* java.util.TimeZone
-   Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -809,6 +810,21 @@
   public abstract int getOffset(int era, int year, int month,
 				int day, int dayOfWeek, int milliseconds);
 
+  /**
+   * Get the time zone offset for the specified date, modified in case of
+   * daylight savings.  This is the offset to add to UTC to get the local
+   * time.
+   * @param date the date represented in millisecends
+   * since January 1, 1970 00:00:00 GMT.
+   * @since 1.4
+   */
+  public int getOffset(long date)
+  {
+    return (inDaylightTime(new Date(date))
+            ? getRawOffset() + getDSTSavings()
+            : getRawOffset());
+  }
+  
   /**
    * Gets the time zone offset, ignoring daylight savings.  This is
    * the offset to add to UTC to get the local time.

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