xml-xmlbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Bau" <david....@bea.com>
Subject RE: GDateBuilder question
Date Tue, 23 Sep 2003 16:24:55 GMT
I'm copying this thread to xmlbeans-dev, hope it's OK.

Those are two different APIs on GDateBuilder

setTimeZone is supposed to set the timezone fields without changing other
fields.  Like the other field-setting APIs, it can and will change the
actual time.

normalizeToTimeZone doesn't change the "actual" time, but reexpresses it in
terms of the timezone that you specify.

The GDate/GDateBuilder classes currently aren't aware of the difference
between Z, +0:00 and -0:00, although we should be able to rework their code
to teach them to track the difference.

Out of curiousity, Robert, can you explain to me what is the actual
difference between Z and +0:00?

David
----- Original Message ----- 
From: "Eric Vasilik" <ericvas@bea.com>
To: "David Bau" <davidbau@bea.com>; "Robert Wyrick" <rwyrick@fedex.com>
Sent: Tuesday, September 23, 2003 11:38 AM
Subject: [bea-readme] RE: GDateBuilder question


I've started to look into this and I noticed the two pieces of code which
look like they are trying to do the same thing, but are different.  Dave,
are these two supposed to be different checks?  These are from
GDateBuilder.java.


    public void setTimeZone(int tzSign, int tzHour, int tzMinute)
    {
        if (!((tzSign == 0 && tzHour == 0 && tzMinute == 0) ||
              ((tzSign == -1 || tzSign == 1) &&
               (tzHour >= 0 && tzMinute >= 0) &&
               (tzHour == 14 && tzMinute == 0 || tzHour < 14 && tzMinute
<
60))))
            throw new IllegalArgumentException("time zone out of range
(-14:00 to +14:00). (" +
                (tzSign<0 ? "-" : "+") + tzHour + ":" + tzMinute + ")");




    public void normalizeToTimeZone(int tzSign, int tzHour, int tzMinute)
    {
        if (!((tzSign == 0 && tzHour == 0 && tzMinute == 0) ||
              ((tzSign == -1 || tzSign == 1) &&
               (tzHour == 0 && tzMinute > 0 || tzHour > 0 && tzMinute
>= 0)
&&
               (tzHour == 14 && tzMinute == 0 || tzHour < 14 && tzMinute
<
60))))
            throw new IllegalArgumentException("time zone must be
betwen -14:00 and +14:00");

-----Original Message-----
From: Robert Wyrick [mailto:rwyrick@fedex.com]
Sent: Monday, September 22, 2003 3:02 PM
To: Eric Vasilik
Subject: GDateBuilder question


We're having problems creating a timestamp with an explicit offset of
'+00:00'.

Why is it that a call to:
        gdateBuilder.setTimeZone(1,0,0);
fails with an exception?

We know that using:
        gdateBuilder.setTimeZone(0,0,0);
will give a "technically" correct time, but it produces HH:MM::SSZ, when we
want HH:MM:SS+00:00...

The exception thrown is especially confusing:
Exception in thread "main" java.lang.RuntimeException: Troublesome union
exception caused by unexpected java.lang.IllegalArgumentException: time
zone must be betwen -14:00 and +14:00
    at com.bea.xbean.values.XmlUnionImpl.set_text(XmlUnionImpl.java:125)
    at
com.bea.xbean.values.XmlObjectBase.update_from_wscanon_text(XmlObjectBase.ja
va:1003)
    at com.bea.xbean.values.XmlObjectBase.set_String(XmlObjectBase.java:951)



- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Mime
View raw message