Makefile.am: Added natTimeZone.cc.
* Makefile.am: Added natTimeZone.cc. * Makefile.in: Rebuilt. * gnu/gcj/text/LocaleData_en.java: Added DateFormat entries. * java/text/DateFormatSymbols.java (ampms): Made package private. (eras): Made package private. (months): Made package private. (shortMonths): Made package private. (shortWeekdays): Made package private. (weekdays): Made package private. (formatPrefixes): New private field. (localPatternCharsDefault): Made private. (dateFormats): New package private field. (timeFormats): New package private field. (formatsForKey): New private method. (DateFormatSymbols(Locale)): Set dateFormats and timeFormats. (DateFormatSymbols(DateFormatSymbols)): Ditto. * java/text/SimpleDateFormat.java: Merged with Classpath. * java/util/TimeZone.java: Merged with Classpath. * java/util/natTimeZone.cc: New file. From-SVN: r37808
This commit is contained in:
parent
9734e80cad
commit
a22add7268
@ -1,3 +1,25 @@
|
||||
2000-11-27 Warren Levy <warrenl@cygnus.com>
|
||||
|
||||
* Makefile.am: Added natTimeZone.cc.
|
||||
* Makefile.in: Rebuilt.
|
||||
* gnu/gcj/text/LocaleData_en.java: Added DateFormat entries.
|
||||
* java/text/DateFormatSymbols.java (ampms): Made package private.
|
||||
(eras): Made package private.
|
||||
(months): Made package private.
|
||||
(shortMonths): Made package private.
|
||||
(shortWeekdays): Made package private.
|
||||
(weekdays): Made package private.
|
||||
(formatPrefixes): New private field.
|
||||
(localPatternCharsDefault): Made private.
|
||||
(dateFormats): New package private field.
|
||||
(timeFormats): New package private field.
|
||||
(formatsForKey): New private method.
|
||||
(DateFormatSymbols(Locale)): Set dateFormats and timeFormats.
|
||||
(DateFormatSymbols(DateFormatSymbols)): Ditto.
|
||||
* java/text/SimpleDateFormat.java: Merged with Classpath.
|
||||
* java/util/TimeZone.java: Merged with Classpath.
|
||||
* java/util/natTimeZone.cc: New file.
|
||||
|
||||
2000-11-27 Bryce McKinlay <bryce@albatross.co.nz>
|
||||
|
||||
* java/util/Vector.java (ensureCapacity): Don't increment modCount.
|
||||
|
@ -1229,6 +1229,7 @@ java/net/natPlainDatagramSocketImpl.cc \
|
||||
java/net/natPlainSocketImpl.cc \
|
||||
java/text/natCollator.cc \
|
||||
java/util/natGregorianCalendar.cc \
|
||||
java/util/natTimeZone.cc \
|
||||
java/util/zip/natDeflater.cc \
|
||||
java/util/zip/natInflater.cc
|
||||
|
||||
|
@ -991,6 +991,7 @@ java/net/natPlainDatagramSocketImpl.cc \
|
||||
java/net/natPlainSocketImpl.cc \
|
||||
java/text/natCollator.cc \
|
||||
java/util/natGregorianCalendar.cc \
|
||||
java/util/natTimeZone.cc \
|
||||
java/util/zip/natDeflater.cc \
|
||||
java/util/zip/natInflater.cc
|
||||
|
||||
@ -1142,8 +1143,8 @@ java/lang/reflect/natArray.lo java/lang/reflect/natConstructor.lo \
|
||||
java/lang/reflect/natField.lo java/lang/reflect/natMethod.lo \
|
||||
java/net/natInetAddress.lo java/net/natPlainDatagramSocketImpl.lo \
|
||||
java/net/natPlainSocketImpl.lo java/text/natCollator.lo \
|
||||
java/util/natGregorianCalendar.lo java/util/zip/natDeflater.lo \
|
||||
java/util/zip/natInflater.lo
|
||||
java/util/natGregorianCalendar.lo java/util/natTimeZone.lo \
|
||||
java/util/zip/natDeflater.lo java/util/zip/natInflater.lo
|
||||
libgcjx_la_OBJECTS = gnu/gcj/xlib/natClip.lo \
|
||||
gnu/gcj/xlib/natColormap.lo gnu/gcj/xlib/natDisplay.lo \
|
||||
gnu/gcj/xlib/natDrawable.lo gnu/gcj/xlib/natFont.lo \
|
||||
@ -1684,8 +1685,9 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
|
||||
.deps/java/util/jar/JarException.P .deps/java/util/jar/JarFile.P \
|
||||
.deps/java/util/jar/JarInputStream.P \
|
||||
.deps/java/util/jar/JarOutputStream.P .deps/java/util/jar/Manifest.P \
|
||||
.deps/java/util/natGregorianCalendar.P .deps/java/util/zip/Adler32.P \
|
||||
.deps/java/util/zip/CRC32.P .deps/java/util/zip/CheckedInputStream.P \
|
||||
.deps/java/util/natGregorianCalendar.P .deps/java/util/natTimeZone.P \
|
||||
.deps/java/util/zip/Adler32.P .deps/java/util/zip/CRC32.P \
|
||||
.deps/java/util/zip/CheckedInputStream.P \
|
||||
.deps/java/util/zip/CheckedOutputStream.P \
|
||||
.deps/java/util/zip/Checksum.P \
|
||||
.deps/java/util/zip/DataFormatException.P \
|
||||
|
@ -68,6 +68,16 @@ public final class LocaleData_en extends ListResourceBundle
|
||||
{ "shortWeekdays", shortWeekdaysDefault },
|
||||
{ "weekdays", weekdaysDefault },
|
||||
|
||||
// These are for DateFormat.
|
||||
{ "shortDateFormat", "M/d/yy" }, // Java's Y2K bug.
|
||||
{ "mediumDateFormat", "d-MMM-yy" },
|
||||
{ "longDateFormat", "MMMM d, yyyy" },
|
||||
{ "fullDateFormat", "EEEE MMMM d, yyyy G" },
|
||||
{ "shortTimeFormat", "h:mm a" },
|
||||
{ "mediumTimeFormat", "h:mm:ss a" },
|
||||
{ "longTimeFormat", "h:mm:ss a z" },
|
||||
{ "fullTimeFormat", "h:mm:ss;S 'o''clock' a z" },
|
||||
|
||||
// For RuleBasedCollator.
|
||||
// FIXME: this is nowhere near complete.
|
||||
// In particular we must mark accents as ignorable,
|
||||
|
@ -24,21 +24,29 @@ import java.util.ResourceBundle;
|
||||
public class DateFormatSymbols extends Object
|
||||
implements java.io.Serializable, Cloneable
|
||||
{
|
||||
private String[] ampms;
|
||||
private String[] eras;
|
||||
String[] ampms;
|
||||
String[] eras;
|
||||
private String localPatternChars;
|
||||
private String[] months;
|
||||
private String[] shortMonths;
|
||||
private String[] shortWeekdays;
|
||||
private String[] weekdays;
|
||||
String[] months;
|
||||
String[] shortMonths;
|
||||
String[] shortWeekdays;
|
||||
String[] weekdays;
|
||||
private String[][] zoneStrings;
|
||||
|
||||
private static final long serialVersionUID = -5987973545549424702L;
|
||||
|
||||
// The order of these prefixes must be the same as in DateFormat
|
||||
// FIXME: XXX: Note that this differs from the Classpath implemention
|
||||
// in that there is no "default" entry; that is due to differing
|
||||
// implementations where DateFormat.DEFAULT is MEDIUM here but 4 in
|
||||
// Classpath (the JCL says it should be MEDIUM). That will need to be
|
||||
// resolved in the merge.
|
||||
private static final String[] formatPrefixes = { "full", "long", "medium", "short" };
|
||||
|
||||
private static final String[] ampmsDefault = {"AM", "PM" };
|
||||
private static final String[] erasDefault = {"BC", "AD" };
|
||||
// localPatternCharsDefault is used by SimpleDateFormat.
|
||||
protected static final String localPatternCharsDefault
|
||||
private static final String localPatternCharsDefault
|
||||
= "GyMdkHmsSEDFwWahKz";
|
||||
private static final String[] monthsDefault = {
|
||||
"January", "February", "March", "April", "May", "June",
|
||||
@ -77,6 +85,24 @@ public class DateFormatSymbols extends Object
|
||||
/**/ "Alaska Daylight Time", "ADT", "Anchorage" }
|
||||
};
|
||||
|
||||
// These are each arrays with a value for SHORT, MEDIUM, LONG, FULL,
|
||||
// and DEFAULT (constants defined in java.text.DateFormat). While
|
||||
// not part of the official spec, we need a way to get at locale-specific
|
||||
// default formatting patterns. They are declared package scope so
|
||||
// as to be easily accessible where needed (DateFormat, SimpleDateFormat).
|
||||
transient String[] dateFormats;
|
||||
transient String[] timeFormats;
|
||||
|
||||
private String[] formatsForKey(ResourceBundle res, String key)
|
||||
{
|
||||
String[] values = new String [formatPrefixes.length];
|
||||
for (int i = 0; i < formatPrefixes.length; i++)
|
||||
{
|
||||
values[i] = res.getString(formatPrefixes[i]+key);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
private final Object safeGetResource (ResourceBundle res,
|
||||
String key, Object def)
|
||||
{
|
||||
@ -116,6 +142,9 @@ public class DateFormatSymbols extends Object
|
||||
weekdays = (String[]) safeGetResource (res, "weekdays", weekdaysDefault);
|
||||
zoneStrings = (String[][]) safeGetResource (res, "zoneStrings",
|
||||
zoneStringsDefault);
|
||||
|
||||
dateFormats = formatsForKey(res, "DateFormat");
|
||||
timeFormats = formatsForKey(res, "TimeFormat");
|
||||
}
|
||||
|
||||
public DateFormatSymbols ()
|
||||
@ -134,6 +163,8 @@ public class DateFormatSymbols extends Object
|
||||
shortWeekdays = old.shortWeekdays;
|
||||
weekdays = old.weekdays;
|
||||
zoneStrings = old.zoneStrings;
|
||||
dateFormats = old.dateFormats;
|
||||
timeFormats = old.timeFormats;
|
||||
}
|
||||
|
||||
public String[] getAmPmStrings()
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
72
libjava/java/util/natTimeZone.cc
Normal file
72
libjava/java/util/natTimeZone.cc
Normal file
@ -0,0 +1,72 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <gcj/cni.h>
|
||||
#include <java/util/TimeZone.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
# if HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
# else
|
||||
# include <time.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This method returns a time zone string that is used by the static
|
||||
* initializer in java.util.TimeZone to create the default timezone
|
||||
* instance. This is a key into the timezone table used by
|
||||
* that class.
|
||||
*/
|
||||
jstring
|
||||
java::util::TimeZone::getDefaultTimeZoneId (void)
|
||||
{
|
||||
time_t current_time;
|
||||
char **tzinfo, *tzid;
|
||||
long tzoffset;
|
||||
jstring retval;
|
||||
|
||||
current_time = time(0);
|
||||
|
||||
mktime(localtime(¤t_time));
|
||||
tzinfo = tzname;
|
||||
tzoffset = timezone;
|
||||
|
||||
if ((tzoffset % 3600) == 0)
|
||||
tzoffset = tzoffset / 3600;
|
||||
|
||||
if (!strcmp(tzinfo[0], tzinfo[1]))
|
||||
{
|
||||
tzid = (char*) _Jv_Malloc (strlen(tzinfo[0]) + 6);
|
||||
if (!tzid)
|
||||
return NULL;
|
||||
|
||||
sprintf(tzid, "%s%ld", tzinfo[0], tzoffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
tzid = (char*) _Jv_Malloc (strlen(tzinfo[0]) + strlen(tzinfo[1]) + 6);
|
||||
if (!tzid)
|
||||
return NULL;
|
||||
|
||||
sprintf(tzid, "%s%ld%s", tzinfo[0], tzoffset, tzinfo[1]);
|
||||
}
|
||||
|
||||
retval = JvNewStringUTF (tzid);
|
||||
_Jv_Free (tzid);
|
||||
return retval;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user