Greetings:

The attached patch is for normalizing timezones to zulu time.

While implementing it as prescribed for adding durations to date/times is
fine, you must reverse the timezone sign (+|-).

A negative timezone indicates time behind zulu and must be added to reach
zulu time and the opposite for positive timezones.

See http://www.w3.org/TR/xmlschema-2/#date for a more detailed description.

Enjoy.

--larry

Lawrence J. McCay III
Probaris Technologies, Inc.
718 Arch Street, Suite 300 South
Philadelphia, PA 19106
phone 215-238-0510
cell 856-296-8391
fax 215-238-0577
[EMAIL PROTECTED]
www.probaris.com

-- 
This message has been scanned for viruses and
dangerous content, and is believed to be clean.

Index: DateTimeBase.java
===================================================================
RCS file: 
/cvs/castor/castor/src/main/org/exolab/castor/types/DateTimeBase.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 DateTimeBase.java
--- DateTimeBase.java   3 Mar 2003 07:08:55 -0000       1.1.1.1
+++ DateTimeBase.java   16 Dec 2004 16:50:44 -0000
@@ -42,6 +42,7 @@
  *
  * $Id: DateTimeBase.java,v 1.1.1.1 2003/03/03 07:08:55 kvisco Exp $
  * Date         Author          Changes
+ * 2004-12-16-05:00 Larry McCay Fixed normalization of timezones [EMAIL 
PROTECTED]
  * 08/30/2001   Arnaud Blandin  added to Calendar() (patch from Sébastien 
Stormacq [EMAIL PROTECTED])
  * 05/29/2001   Arnaud Blandin  Added order methods
  * 05/22/2001   Arnaud Blandin  Created
@@ -730,7 +731,13 @@
             Duration temp = new Duration();
             temp.setHour(_zoneHour);
             temp.setMinute(_zoneMinute);
-            if (isZoneNegative())
+
+            // Timezone being negative is a reflection of the time being the 
specified amount of time
+            // behind zulu time. This amount of time must be added in order to 
normalize to zulu time.
+            // A positive timezone indicates the exact opposite and must be 
subtracted from the date/time in order
+            // get to zulu time.
+            // see: http://www.w3.org/TR/xmlschema-2/#date
+            if (!isZoneNegative())
                 temp.setNegative();
             this.addDuration(temp);
             //reset the zone
----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to