diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2005-06-05 19:36:35 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2005-06-05 19:36:35 +0000 |
commit | 9399c41550e32c6bd8ea2d299a09f7151f9dc7dd (patch) | |
tree | a9391598545827aa8cf4e6cda3846509b6e373e0 /java/util/TimeZone.java | |
parent | 9504f4c9901366e510c2d1824a8bf6cfea4e2cc5 (diff) | |
download | classpath-9399c41550e32c6bd8ea2d299a09f7151f9dc7dd.tar.gz |
2005-06-05 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Merge from HEAD-->generics-branch for 2005/05/26 - 2005/06/05.
Changelog:
2005-06-04 Tom Tromey <tromey@redhat.com>
* javax/swing/plaf/basic/BasicListUI.java (focusListener): Use
correct type.
(listDataListener, listSelectionListener, mouseInputListener,
propertyChangeListener): Likewise.
* javax/swing/plaf/basic/BasicMenuUI.java (ChangeHandler): Now
public and deprecated.
* javax/swing/plaf/basic/BasicTabbedPaneUI.java
(TabbedPaneLayout): Now public.
* javax/swing/plaf/basic/BasicOptionPaneUI.java
(ButtonActionListener): Now public.
(PropertyChangeHandler): Likewise.
(ButtonAreaLayout): Likewise.
* javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
(TitlePaneLayout): Now public.
(PropertyChangeHandler): Likewise.
* javax/swing/plaf/basic/BasicCheckBoxUI.java
(getPropertyPrefix): New method.
* javax/swing/plaf/basic/BasicProgressBarUI.java (ChangeHandler):
Now public.
* javax/swing/plaf/basic/BasicSliderUI.java (ComponentHandler):
Now public.
* javax/swing/plaf/basic/BasicSplitPaneUI.java
(BasicVerticalLayoutManager): Now public.
(FocusHandler): Likewise.
(BasicHorizontalLayoutManager): Likewise.
* javax/swing/plaf/basic/BasicFileChooserUI.java
(AcceptAllFileFilter): New public constructor.
(BasicFileView): Likewise.
* javax/swing/plaf/basic/BasicInternalFrameUI.java
(BorderListener.RESIZE_NONE): Now final.
2005-06-04 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CORBA/DefinitionKindHelper.java,
org/omg/CORBA/FieldNameHelper.java,
org/omg/CORBA/IdentifierHelper.java,
org/omg/CORBA/ParameterMode.java,
org/omg/CORBA/ParameterModeHelper.java,
org/omg/CORBA/ParameterModeHolder.java,
org/omg/CORBA/RepositoryIdHelper.java,
org/omg/CORBA/SetOverrideTypeHelper.java,
org/omg/CORBA/VersionSpecHelper.java,
gnu/CORBA/SetOverrideTypeHolder.java,
gnu/CORBA/DefinitionKindHolder.java: New files.
2005-06-04 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/stub/java/rmi/_Remote_Stub.java,
org/omg/stub/java/rmi/package.html: New package.
2005-06-04 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/Messaging/SyncScopeHelper.java
org/omg/Messaging/SYNC_WITH_TRANSPORT.java
org/omg/Messaging/package.html: New package.
2005-06-04 Michael Koch <konqueror@gmx.de>
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
(Java_gnu_java_awt_peer_gtk_GtkImage_loadPixbuf):
Fixed method declaration format.
(Java_gnu_java_awt_peer_gtk_GtkImage_drawPixelsScaled):
Likewise.
2005-06-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* AUTHORS (Roman Kennke): New author.
2005-06-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CORBA/portable/BoxedValueHelper.java,
org/omg/CORBA_2_3/portable/OutputStream.java,
org/omg/CORBA_2_3/portable/Delegate.java,
org/omg/CORBA_2_3/portable/ObjectImpl.java,
org/omg/CORBA_2_3/portable/package.html: New files.
2005-06-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CosNaming/NamingContextPackage/AlreadyBound.java,
org/omg/CosNaming/NamingContextPackage/CannotProceed.java,
org/omg/CosNaming/NamingContextPackage/InvalidName.java,
org/omg/CosNaming/NamingContextPackage/NotEmpty.java,
org/omg/CosNaming/NamingContextPackage/NotFound.java,
org/omg/CosNaming/NamingContextPackage/NotFoundReason.java:
Added SerialVersionUID.
2005-06-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/GIOP/uncObjectInputStream.java,
gnu/CORBA/GIOP/uncObjectInputStream/uncObjectOutputStream.java:
Deleting files.
* gnu/CORBA/CDR/uncObjectInputStream.java,
gnu/CORBA/CDR/uncObjectInputStream/uncObjectOutputStream.java:
Adding files.
2005-06-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/Functional_ORB.java,
gnu/CORBA/IOR_Delegate.java,
gnu/CORBA/Simple_delegate.java,
gnu/CORBA/universalHolder.java,
gnu/CORBA/CDR/aligningInputStream.java,
gnu/CORBA/CDR/aligningOutputStream.java,
gnu/CORBA/CDR/cdrInput.java,
gnu/CORBA/CDR/cdrOutput.java,
gnu/CORBA/CDR/encapsulatedOutput.java,
gnu/CORBA/GIOP/ErrorMessage.java,
gnu/CORBA/GIOP/MessageHeader.java,
gnu/CORBA/GIOP/cxCodeSet.java,
gnu/CORBA/GIOP/v1_2/RequestHeader.java,
org/omg/CosNaming/BindingIteratorHelper.java,
org/omg/CosNaming/BindingListHelper.java,
org/omg/CosNaming/BindingTypeHelper.java,
org/omg/CosNaming/NameComponentHelper.java,
org/omg/CosNaming/NameHelper.java,
org/omg/CosNaming/NamingContextExtHelper.java,
org/omg/CosNaming/NamingContextHelper.java:
Initialise instances of org.omg.SystemException, thrown
after catching the other exception, with InitCause.
2005-06-03 Roman Kennke <roman@kennke.org>
* javax/swing/plaf/basic/BasicListUI.java
(damageLayout): Check for list beeing null before revalidating
it.
2005-06-03 Roman Kennke <roman@kennke.org>
* javax/swing/text/PlainDocument.java
(removeUpdate): Fixed indices in text buffer access.
* javax/swing/text/PlainView.java
(drawLine): Simplified element access.
2005-06-03 Roman Kennke <roman@kennke.org>
* javax/swing/JTextArea.java
(constructor): Set preferredSize to a sane default.
2005-06-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/GIOP/uncObjectInputStream.java,
gnu/CORBA/GIOP/uncObjectInputStream/uncObjectOutputStream.java: New streams.
* org/omg/CORBA/ValueBaseHelper.java: Removing inner classes,
using uncObjectInputStream, uncObjectOutputStream instead.
* org/omg/CORBA_2_3/portable (read_value): Delegate call to
ValueBaseHelper.
2005-06-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CORBA/SendingContext/Runtime.java,
org/omg/CORBA/SendingContext/RunTimeOperations.java:
Fixing the package statement.
2005-06-03 Roman Kennke <roman@kennke.org>
* javax/swing/SwingUtilites.java
(replaceUIActionMap): Fixed loop again. Now correctly, I hope.
* javax/swing/ActionMap.java
(setParent): Make sure we don't build a loop.
* javax/swing/plaf/basic/BasicTextUI.java
(createActionMap): Create ActionMapUIResource instead of
plain ActionMap.
2005-06-03 Sven de Marothy <sven@physto.se>
* gnu/java/awt/peer/gtk/GdkGraphics.java:
Removed declarations for the previously removed native methods.
2005-06-03 Roman Kennke <roman@kennke.org>
* javax/swing/SwingUtilites.java
(replaceUIActionMap): Fixed condition in while loop that caused
infinite looping.
2005-06-03 Roman Kennke <roman@kennke.org>
* javax/swing/plaf/basic/BasicTableUI.java
(uninstallDefault): Don't set properties to null, this corrupts
component state.
2005-06-02 Andrew John Hughes <gnu_andrew@member.fsf.org>
* lib/Makefile.am:
Fix permissions problem with creation of META-INF tree.
2005-06-02 Sven de Marothy <sven@physto.se>
* java/awt/Component.java
(setBackgroundColor): Return if the color equals the existing bgcolor.
2005-06-02 Sven de Marothy <sven@physto.se>
* gnu/java/awt/peer/gtk/GdkGraphics2D.java:
(drawImage): Remove reference to GtkOffScreenImage.
* gnu/java/awt/peer/gtk/GtkImageConsumer.java:
Add additional comments.
2005-06-02 Sven de Marothy <sven@physto.se>
* gnu/java/awt/peer/gtk/GdkGraphics.java:
(GdkGraphics): New constructor.
(drawImage): Reimplemented.
* gnu/java/awt/peer/gtk/GtkComponentPeer.java:
(checkImage,createImage): Reimplemented.
(prepareImage): Just call the GdkToolkit method.
* gnu/java/awt/peer/gtk/GtkFramePeer.java:
(setIconImage): Reimplemented.
* gnu/java/awt/peer/gtk/GtkImage.java: Reimplemented.
* gnu/java/awt/peer/gtk/GtkToolkit.java:
(checkImage): Change handling of GtkImage.
(createImage): Reimplemented for GtkImage.
(getColorModel): Return the actual native color model.
(prepareImage): Reimplemented.
* include/Makefile.am,
* native/jni/gtk-peer/Makefile.am: Removed old files, added new ones.
* include/gnu_java_awt_peer_gtk_GdkGraphics.h,
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c:
(initFromImage): New method.
(copyPixmap, flip_pixbuf, copyAndScalePixmap): Removed.
* include/gnu_java_awt_peer_gtk_GtkFramePeer.h,
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c:
(nativeSetIconImage): New method.
(nativeSetIconImageFromData,nativeSetIconImageFromDecoder): Removed.
* gnu/java/awt/peer/gtk/GtkImageConsumer.java,
* include/gnu_java_awt_peer_gtk_GtkImage.h,
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c:
New files.
* gnu/java/awt/peer/gtk/GtkImagePainter.java,
* gnu/java/awt/peer/gtk/GtkOffScreenImage.java,
* include/gnu_java_awt_peer_gtk_GtkImagePainter.h,
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c:
Removed files.
2005-06-01 Tom Tromey <tromey@redhat.com>
* java/io/ObjectInputStream.java (currentLoader): Fixed typo.
2005-06-01 Tom Tromey <tromey@redhat.com>
* org/omg/CosNaming/IstringHelper.java: Changed non-ascii
characters.
2005-06-01 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/SendingContext/package.html,
org/omg/SendingContext/RunTimeOperations.java,
org/omg/SendingContext/Runtime.java: New package.
2005-06-01 Roman Kennke <roman@kennke.org>
* javax/swing/text/DefaultStyledDocument.java
(setLogicalStyle): Implemented this method.
2005-06-01 Sven de Marothy <sven@physto.se>
* java/util/GregorianCalendar.java
(setTimeInMillis): Recompute time fields.
2005-06-01 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CosNaming/BindingType.java,
org/omg/CosNaming/NameComponent.java,
org/omg/CosNaming/_BindingIteratorStub.java,
org/omg/CosNaming/_NamingContextStub.java,
org/omg/CosNaming/_NamingContextExtStub.java,
org/omg/CosNaming/_BindingIteratorImplBase.java,
org/omg/CosNaming/_NamingContextImplBase.java: Added SerialVersionUID.
2005-06-01 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CosNaming/IstringHelper.java: New class.
2005-06-01 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/CDR/cdrInput.java (read_wstring): Correcting
check for native encoding.
2005-06-01 Roman Kennke <roman@kennke.org>
* javax/swing/plaf/basic/BasicFileChooserUI.java
(installComponents): Changed layout of main panel from GridBagLayout
to BorderLayout (as is the case in Suns JDK). This fixes
bug#13244.
2005-06-01 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/Functional_ORB.java (serveStep),
gnu/CORBA/gnuRequest.java (submit),
gnu/CORBA/CDR/cdrInput.java (read_encapsulation): Correcting
data read loop.
2005-06-01 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/Functional_ORG.java (getFreePort): Remember
the port number in the local variable.
2005-06-01 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* examples/gnu/classpath/examples/CORBA/SimpleCommunication/
communication/ourUserExceptionHelper.java (extract): New method.
* examples/gnu/classpath/examples/CORBA/SimpleCommunication/
communication/RequestTest.java:Use helper extract method.
2005-06-01 Roman Kennke <roman@kennke.org>
* javax/swing/JPopupMenu.java
(insert): Do not check for index == -1 at this point, this is done
in java.awt.Container. Catching -1 indices here disturbes the
Container.addImpl which leads to bug #13247 for example.
2005-06-01 Roman Kennke <roman@kennke.org>
* javax/swing/text/PlainDocument.java
(removeUpdate): Fixed indices in call to rootElement.replace().
2005-06-01 Roman Kennke <roman@kennke.org>
* javax/swing/JComponent.java
(processKeyEvent): Call super.processKeyEvent() so that KeyEvents
are delivered to registered KeyListeners.
2005-05-31 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CORBA_2_3/ORB.java,
org/omg/CORBA_2_3/portable/InputStream.java,
org/omg/CORBA/portable/ValueFactory.java: New classes.
2005-05-31 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg.CORBA/DynValue.java (declaration): Inherit from DynAny,
org.omg.CORBA.Object. (set_members): Declare it may throw InvalidSeq.
2005-06-01 Sven de Marothy <sven@physto.se>
* java/util/TimeZone (getDefaultTimeZone): Reimplemented.
(parseTime, getDateParams): New private methods.
2005-06-01 David Gilbert <david.gilbert@object-refinery.com>
* gnu/java/awt/GradientPaintContext.java: New file.
* java/awt/GradientPaint.java: Implemented.
* java/awt/image/IndexColorModel.java: Reimplemented.
2005-05-31 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/CDR/BigEndianInputStream.java,
gnu/CORBA/CDR/BigEndianOutputStream.java,
gnu/CORBA/CDR/LittleEndianInputStream.java,
gnu/CORBA/CDR/LittleEndianOutputStream.java: New streams.
gnu/CORBA/CDR/abstractDataInputStream.java,
gnu/CORBA/CDR/abstractDataOutputStream.java: New interfaces.
* gnu/CORBA/IOR.java: Implemented parsing of the Little
Endian encoded IOR references.
* gnu/CORBA/Functional_ORB.java,
gnu/CORBA/binaryReply.java,
gnu/CORBA/gnuRequest.java,
gnu/CORBA/CDR/cdrInput.java,
gnu/CORBA/CDR/cdrOutput.java,
gnu/CORBA/CDR/encapsulatedOutput.java,
gnu/CORBA/GIOP/MessageHeader.java: Implemented support
for Big and Little Endian.
* org/omg/CORBA/package.html: Documentation update.
2005-05-31 Jeroen Frijters <jeroen@frijters.net>
* java/net/ServerSocket.java
(bound): Removed.
(local): New field.
(bind): Cache local socket address.
(getInetAddress, getLocalPort, getLocalSocketAddress, isBound):
Use cached local socket address.
(close): bound field was removed.
2005-05-31 Jeroen Frijters <jeroen@frijters.net>
* gnu/java/nio/channels/FileChannelImpl.java
(FileChannelImpl()): Removed.
(FileChannelImpl(File,int)): Made private.
(create): New method.
* java/io/FileInputStream.java,
java/io/FileOutputStream.java,
java/io/RandomAccessFile.java:
Updated construction of FileChannelImpl instance.
2005-05-31 Sven de Marothy <sven@physto.se>
* java/awt/image/BufferedImage.java:
(ImageProducer): Use Vector instead of HashMap.
* java/awt/image/DirectColorModel.java:
(getAlpha): Default to 255 (opaque).
2005-05-30 Roman Kennke <roman@kennke.org>
* javax/swing/JTree.java
(getNextMatch): Implemented new method.
2005-05-30 Roman Kennke <roman@kennke.org>
* javax/swing/plaf/metal/MetalSplitPaneUI.java:
(createUI): Do not share one instance of MetalSplitPaneUI
between multiple JSplitPanes.
2005-05-30 Roman Kennke <roman@kennke.org>
* javax/swing/JComponent.java:
Made JComponent.AccessibleJComponent implement
AccessibleExtendedComponent.
2005-05-30 Roman Kennke <roman@kennke.org>
* javax/swing/JButton.java
(constructor): Set initial actionCommand equal to the buttons label.
2005-05-30 Roman Kennke <roman@kennke.org>
* javax/swing/JList.java
(getNextMatch): Implemented new method.
(getCellBounds): Implemented new method.
2005-05-30 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/Functional_ORB.java (serve, portServer, serveStep):
Implemented support for the subsequent invocations reusing the same
socket.
* gnu/CORBA/GIOP/MessageHeader.java (read): throw
NO_IMPLEMENT, not MARSHAL for Little Endian request.
2005-05-30 Roman Kennke <roman@kennke.org>
* javax/swing/JLayeredPane.java
(putLayer): Implemented new method.
2005-05-30 Roman Kennke <roman@kennke.org>
* javax/swing/JFileChooser.java:
Fixed values of some constant fields.
2005-05-30 Roman Kennke <roman@kennke.org>
* javax/swing/SwingUtilities.java:
(getWindowAncestor): This method has to be static instead of
non-static.
2005-05-29 Michael Koch <konqueror@gmx.de>
* java/util/LinkedHashMap.java (access): Set 'root.pred'.
2005-05-29 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CosNaming/_BindingIteratorImplBase.java ,
org/omg/CosNaming/_NamingContextExtImplBase.java,
org/omg/CosNaming/_NamingContextImplBase.java: Inherit from
DynamicImplementation.
* gnu/CORBA/ServiceRequestAdapter.java: New class.
* gnu/CORBA/gnuNVList.java (add, add_item):
Replacing null by constructed instance.
2005-05-29 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CORBA/Functional_ORB.java (serve, useProperties, init):
Implementing the property-configurable time-outs.
2005-05-29 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/gnuRequest.java (p_invoke): Wrap the received UserException into
UnknownUserException.
* gnu/CORBA/streamReadyHolder.java: New wrapper for UserException.
* org/omg/CORBA/UnknownUserException.java: New exception.
2005-05-27 Roman Kennke <roman@kennke.org>
* javax/swing/AbstractButton.java:
Bumped up serialVersionUID(s) to JDK1.4 compatibility.
* javax/swing/ImageIcon.java: Likewise.
* javax/swing/JFileChooser.java: Likewise.
* javax/swing/JInternalFrame.java: Likewise.
* javax/swing/JMenu.java: Likewise.
* javax/swing/JRadioButton.java: Likewise.
* javax/swing/JScrollPane.java: Likewise.
* javax/swing/JSpinner.java: Likewise.
* javax/swing/JTabbedPane.java: Likewise.
* javax/swing/ImageIcons.java: Likewise.
* javax/swing/JToggleButton.java: Likewise.
* javax/swing/JToolTip.java: Likewise.
* javax/swing/JViewPort.java: Likewise.
* javax/swing/LayoutFocusTraversalPolicy.java: Likewise.
* javax/swing/SpinnerDateModel.java: Likewise.
* javax/swing/TransferHandler.java: Likewise.
2005-05-27 Thomas Fitzsimmons <fitzsim@redhat.com>
* gnu/java/awt/peer/gtk/GtkContainerPeer.java (setFont): Handle
lightweight peers specially.
2005-05-27 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* omg/org/CORBA/ORB.java (create_recursive_sequence_tc): New method.
2005-05-27 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* omg/org/CORBA/DynValue.java: New interface.
2005-05-27 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* omg/org/CORBA/package.html: Documentation update.
2005-05-26 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CORBA/ORB.java (create_basic_dyn_any):
Declare it may throw an InconsistentTypeCode.
(create_dyn_any): Remove wrong exception declaration.
(create_operation_list, create_abstract_interface_tc,
create_native_tc, get_service_information): Implementing these methods.
* org/omg/CORBA/ServerRequest.java (result, except, params, op_name):
Marking deprecated.
Diffstat (limited to 'java/util/TimeZone.java')
-rw-r--r-- | java/util/TimeZone.java | 356 |
1 files changed, 274 insertions, 82 deletions
diff --git a/java/util/TimeZone.java b/java/util/TimeZone.java index 7b7947f63..94082fbd2 100644 --- a/java/util/TimeZone.java +++ b/java/util/TimeZone.java @@ -1,5 +1,5 @@ /* java.util.TimeZone - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -810,13 +810,20 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable * with the result of <code>System.getProperty("user.timezone")</code> * or <code>getDefaultTimeZoneId()</code>. Note that giving one of * the standard tz data names from ftp://elsie.nci.nih.gov/pub/ is - * preferred. The time zone name can be given as follows: - * <code>(standard zone name)[(GMT offset)[(daylight time zone name)]]</code> + * preferred. + * The time zone name can be given as follows: + * <code>(standard zone name)[(GMT offset)[(DST zone name)[DST offset]]] + * </code> * <p> * If only a (standard zone name) is given (no numbers in the * String) then it gets mapped directly to the TimeZone with that * name, if that fails null is returned. * <p> + * Alternately, a POSIX-style TZ string can be given, defining the time zone: + * <code>std offset dst offset,date/time,date/time</code> + * See the glibc manual, or the man page for <code>tzset</code> for details + * of this format. + * <p> * A GMT offset is the offset to add to the local time to get GMT. * If a (GMT offset) is included (either in seconds or hours) then * an attempt is made to find a TimeZone name matching both the name @@ -843,93 +850,278 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable */ static TimeZone getDefaultTimeZone(String sysTimeZoneId) { - // First find start of GMT offset info and any Daylight zone name. - int startGMToffset = 0; - int sysTimeZoneIdLength = sysTimeZoneId.length(); - for (int i = 0; i < sysTimeZoneIdLength && startGMToffset == 0; i++) + String stdName = null; + String dstName; + int stdOffs; + int dstOffs; + try + { + int idLength = sysTimeZoneId.length(); + + int index = 0; + int prevIndex; + char c; + + // get std + do + c = sysTimeZoneId.charAt(index++); + while (c != '+' && c != '-' && c != ',' && c != ':' + && ! Character.isDigit(c) && c != '\0' && index < idLength); + + if (index >= idLength) + return (TimeZone)timezones().get(sysTimeZoneId); + + stdName = sysTimeZoneId.substring(0, --index); + prevIndex = index; + + // get the std offset + do + c = sysTimeZoneId.charAt(index++); + while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c)) + && index < idLength); + if (index < idLength) + index--; + + { // convert the dst string to a millis number + String offset = sysTimeZoneId.substring(prevIndex, index); + prevIndex = index; + + if (offset.charAt(0) == '+' || offset.charAt(0) == '-') + stdOffs = parseTime(offset.substring(1)); + else + stdOffs = parseTime(offset); + + if (offset.charAt(0) == '-') + stdOffs = -stdOffs; + + // TZ timezone offsets are positive when WEST of the meridian. + stdOffs = -stdOffs; + } + + // Done yet? (Format: std offset) + if (index >= idLength) + { + // Do we have an existing timezone with that name and offset? + TimeZone tz = (TimeZone) timezones().get(stdName); + if (tz != null) + if (tz.getRawOffset() == stdOffs) + return tz; + + // Custom then. + return new SimpleTimeZone(stdOffs, stdName); + } + + // get dst + do + c = sysTimeZoneId.charAt(index++); + while (c != '+' && c != '-' && c != ',' && c != ':' + && ! Character.isDigit(c) && c != '\0' && index < idLength); + + // Done yet? (Format: std offset dst) + if (index >= idLength) + { + // Do we have an existing timezone with that name and offset + // which has DST? + TimeZone tz = (TimeZone) timezones().get(stdName); + if (tz != null) + if (tz.getRawOffset() == stdOffs && tz.useDaylightTime()) + return tz; + + // Custom then. + return new SimpleTimeZone(stdOffs, stdName); + } + + // get the dst offset + dstName = sysTimeZoneId.substring(prevIndex, --index); + prevIndex = index; + do + c = sysTimeZoneId.charAt(index++); + while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c)) + && index < idLength); + if (index < idLength) + index--; + + { // convert the dst string to a millis number + String offset = sysTimeZoneId.substring(prevIndex, index); + prevIndex = index; + + if (offset.charAt(0) == '+' || offset.charAt(0) == '-') + dstOffs = parseTime(offset.substring(1)); + else + dstOffs = parseTime(offset); + + if (offset.charAt(0) == '-') + dstOffs = -dstOffs; + + // TZ timezone offsets are positive when WEST of the meridian. + dstOffs = -dstOffs; + } + + // Done yet? (Format: std offset dst offset) + // FIXME: We don't support DST without a rule given. Should we? + if (index >= idLength) + { + // Time Zone existing with same name, dst and offsets? + TimeZone tz = (TimeZone) timezones().get(stdName); + if (tz != null) + if (tz.getRawOffset() == stdOffs && tz.useDaylightTime() + && tz.getDSTSavings() == (dstOffs - stdOffs)) + return tz; + + return new SimpleTimeZone(stdOffs, stdName); + } + + // get the DST rule + if (sysTimeZoneId.charAt(index) == ',' + || sysTimeZoneId.charAt(index) == ';') + { + index++; + int offs = index; + while (sysTimeZoneId.charAt(index) != ',' + && sysTimeZoneId.charAt(index) != ';') + index++; + String startTime = sysTimeZoneId.substring(offs, index); + index++; + String endTime = sysTimeZoneId.substring(index); + + index = startTime.indexOf('/'); + int startMillis; + int endMillis; + String startDate; + String endDate; + if (index != -1) + { + startDate = startTime.substring(0, index); + startMillis = parseTime(startTime.substring(index + 1)); + } + else + { + startDate = startTime; + // if time isn't given, default to 2:00:00 AM. + startMillis = 2 * 60 * 60 * 1000; + } + index = endTime.indexOf('/'); + if (index != -1) + { + endDate = endTime.substring(0, index); + endMillis = parseTime(endTime.substring(index + 1)); + } + else + { + endDate = endTime; + // if time isn't given, default to 2:00:00 AM. + endMillis = 2 * 60 * 60 * 1000; + } + + int[] start = getDateParams(startDate); + int[] end = getDateParams(endDate); + return new SimpleTimeZone(stdOffs, stdName, start[0], start[1], + start[2], startMillis, end[0], end[1], + end[2], endMillis, (dstOffs - stdOffs)); + } + } + + // FIXME: Produce a warning here? + catch (IndexOutOfBoundsException _) { - char c = sysTimeZoneId.charAt(i); - if (Character.isDigit(c)) - startGMToffset = i; - else if ((c == '+' || c == '-') - && i + 1 < sysTimeZoneIdLength - && Character.isDigit(sysTimeZoneId.charAt(i + 1))) - startGMToffset = i; } - - String tzBasename; - if (startGMToffset == 0) - tzBasename = sysTimeZoneId; - else - tzBasename = sysTimeZoneId.substring (0, startGMToffset); - - int startDaylightZoneName = 0; - for (int i = sysTimeZoneIdLength - 1; - i >= 0 && !Character.isDigit(sysTimeZoneId.charAt(i)); --i) - startDaylightZoneName = i; - - boolean useDaylightTime = startDaylightZoneName > 0; - - // Integer.parseInt() doesn't handle leading +. - if (sysTimeZoneId.charAt(startGMToffset) == '+') - startGMToffset++; - - int gmtOffset = 0; - if (startGMToffset > 0) + catch (NumberFormatException _) { - gmtOffset = Integer.parseInt - (startDaylightZoneName == 0 - ? sysTimeZoneId.substring(startGMToffset) - : sysTimeZoneId.substring(startGMToffset, - startDaylightZoneName)); - - // Offset could be in hours or seconds. Convert to millis. - // The offset is given as the time to add to local time to get GMT - // we need the time to add to GMT to get localtime. - if (Math.abs(gmtOffset) < 24) - gmtOffset *= 60 * 60; - gmtOffset *= -1000; } - - // Try to be optimistic and get the timezone that matches the base name. - // If we only have the base name then just accept this timezone. - // Otherwise check the gmtOffset and day light attributes. - TimeZone tz = (TimeZone) timezones().get(tzBasename); - if (tz != null - && (tzBasename == sysTimeZoneId - || (tz.getRawOffset() == gmtOffset - && tz.useDaylightTime() == useDaylightTime))) - return tz; - - // Maybe there is one with the daylight zone name? - if (useDaylightTime) + + return null; + } + + /** + * Parses and returns the params for a POSIX TZ date field, + * in the format int[]{ month, day, dayOfWeek }, following the + * SimpleTimeZone constructor rules. + */ + private static int[] getDateParams(String date) + { + int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; + int month; + + if (date.charAt(0) == 'M' || date.charAt(0) == 'm') { - String daylightZoneName; - daylightZoneName = sysTimeZoneId.substring(startDaylightZoneName); - if (!daylightZoneName.equals(tzBasename)) - { - tz = (TimeZone) timezones().get(tzBasename); - if (tz != null - && tz.getRawOffset() == gmtOffset - && tz.useDaylightTime()) - return tz; - } + int day; + + // Month, week of month, day of week + month = Integer.parseInt(date.substring(1, date.indexOf('.'))); + int week = Integer.parseInt(date.substring(date.indexOf('.') + 1, + date.lastIndexOf('.'))); + int dayOfWeek = Integer.parseInt(date.substring(date.lastIndexOf('.') + + 1)); + if (week == 5) + day = -1; // last day of month is -1 in java, 5 in TZ + else + // first day of week starting on or after. + day = (week - 1) * 7 + 1; + + dayOfWeek++; // Java day of week is one-based, Sunday is first day. + month--; // Java month is zero-based. + return new int[] { month, day, dayOfWeek }; } - - // If no match, see if a valid timezone has similar attributes as this - // and then use it instead. We take the first one that looks OKish. - if (startGMToffset > 0) + + // julian day, either zero-based 0<=n<=365 (incl feb 29) + // or one-based 1<=n<=365 (no feb 29) + int julianDay; // Julian day, + + if (date.charAt(0) != 'J' || date.charAt(0) != 'j') { - String[] ids = getAvailableIDs(gmtOffset); - for (int i = 0; i < ids.length; i++) - { - tz = (TimeZone) timezones().get(ids[i]); - if (tz.useDaylightTime() == useDaylightTime) - return tz; - } + julianDay = Integer.parseInt(date.substring(1)); + julianDay++; // make 1-based + // Adjust day count to include feb 29. + dayCount = new int[] + { + 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 + }; } - - return null; + else + // 1-based julian day + julianDay = Integer.parseInt(date); + + int i = 11; + while (i > 0) + if (dayCount[i] < julianDay) + break; + else + i--; + julianDay -= dayCount[i]; + month = i; + return new int[] { month, julianDay, 0 }; + } + + /** + * Parses a time field hh[:mm[:ss]], returning the result + * in milliseconds. No leading sign. + */ + private static int parseTime(String time) + { + int millis = 0; + int i = 0; + + while (i < time.length()) + if (time.charAt(i) == ':') + break; + else + i++; + millis = 60 * 60 * 1000 * Integer.parseInt(time.substring(0, i)); + if (i >= time.length()) + return millis; + + int iprev = ++i; + while (i < time.length()) + if (time.charAt(i) == ':') + break; + else + i++; + if (i >= time.length()) + return millis; + + millis += 60 * 1000 * Integer.parseInt(time.substring(iprev, i)); + millis += 1000 * Integer.parseInt(time.substring(++i)); + return millis; } /** |