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

PATCH: More time zone fixes


Folks,
Here's some more time zone fixes to clean up some of the code I checked in
yesterday.  Enjoy!
--warrenl


2000-11-28  Warren Levy  <warrenl@cygnus.com>

        * java/text/DateFormatSymbols.java (zoneStringsDefault): Added
        more time zone entries.
        * java/text/SimpleDateFormat.java (format): Added case for 
        TIMEZONE_FIELD.



Index: java/text/DateFormatSymbols.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/text/DateFormatSymbols.java,v
retrieving revision 1.6
diff -u -p -r1.6 DateFormatSymbols.java
--- DateFormatSymbols.java	2000/11/28 03:09:21	1.6
+++ DateFormatSymbols.java	2000/11/28 20:01:35
@@ -65,6 +65,8 @@ public class DateFormatSymbols extends O
   };
 
   private static String[][] zoneStringsDefault = {
+    { "GMT", "Greenwich Mean Time", "GMT",
+      /**/   "Greenwich Mean Time", "GMT", "GMT" },
     { "PST", "Pacific Standard Time", "PST",
       /**/   "Pacific Daylight Time", "PDT", "San Francisco" },
     { "MST", "Mountain Standard Time", "MST",
@@ -82,7 +84,21 @@ public class DateFormatSymbols extends O
     { "HST", "Hawaii Standard Time", "HST",
       /**/   "Hawaii Daylight Time", "HDT", "Honolulu" },
     { "AST", "Alaska Standard Time", "AST",
-      /**/   "Alaska Daylight Time", "ADT", "Anchorage" }
+      /**/   "Alaska Daylight Time", "ADT", "Anchorage" },
+    { "PST8PDT", "Pacific Standard Time", "PST",
+      /******/   "Pacific Daylight Time", "PDT", "San Francisco" },
+    { "MST7MDT", "Mountain Standard Time", "MST",
+      /******/   "Mountain Daylight Time", "MDT", "Denver" },
+    { "CST6CDT", "Central Standard Time", "CST",
+      /******/   "Central Daylight Time", "CDT", "Chicago" },
+    { "EST5EDT", "Eastern Standard Time", "EST",
+      /******/   "Eastern Daylight Time", "EDT", "Boston" },
+    { "AST4ADT", "Atlantic Standard Time", "AST",
+      /******/   "Atlantic Daylight Time", "ADT", "Halifax" },
+    { "HST10HDT", "Hawaii Standard Time", "HST",
+      /*******/   "Hawaii Daylight Time", "HDT", "Honolulu" },
+    { "AST9ADT", "Alaska Standard Time", "AKST",
+      /******/   "Alaska Daylight Time", "AKDT", "Anchorage" }
   };
 
   // These are each arrays with a value for SHORT, MEDIUM, LONG, FULL,
Index: java/text/SimpleDateFormat.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/text/SimpleDateFormat.java,v
retrieving revision 1.6
diff -u -p -r1.6 SimpleDateFormat.java
--- SimpleDateFormat.java	2000/11/28 03:09:21	1.6
+++ SimpleDateFormat.java	2000/11/28 20:01:35
@@ -454,7 +454,11 @@ public class SimpleDateFormat extends Da
 	  withLeadingZeros(theCalendar.get(Calendar.HOUR)-1,p.size,buffer);
 	  break;
 	case TIMEZONE_FIELD:
-	  // TODO
+	  TimeZone zone = theCalendar.getTimeZone();
+	  boolean isDST = theCalendar.get(Calendar.DST_OFFSET) != 0;
+	  // FIXME: XXX: This should be a localized time zone.
+	  String zoneID = zone.getDisplayName(isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT);
+	  buffer.append(zoneID);
 	  break;
 	default:
 	  throw new IllegalArgumentException("Illegal pattern character");
@@ -1088,7 +1092,7 @@ public class SimpleDateFormat extends Da
 
 	  /*
 	case TIMEZONE_FIELD:
-	  // TODO
+	  // TODO: FIXME: XXX
 	  break;
 	  */
 

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