need to update TimestampUtils code - Mailing list pgsql-jdbc

From Do, Leon (Leon)
Subject need to update TimestampUtils code
Date
Msg-id D1EE06BA46B1E4449AF9A4F2FBEE18615E3021@ILEXC2U01.ndc.lucent.com
Whole thread Raw
Responses Re: need to update TimestampUtils code
List pgsql-jdbc

Hi,

 

Can someone help me to update this small block of code (see BEGIN and END block) in the TimestampUtils class or tell me the direction to do it?  The code allow the util to parse the timezone in both format hhmm or hh:mm.   

 

            // Possibly read timezone.

            sep = charAt(s, start);

            if (sep == '-' || sep == '+') {

                int tzsign = (sep == '-') ? -1 : 1;

                int tzhr, tzmin;

   

                end = firstNonDigit(s, start+1);    // Skip +/-

 

                //CHANGES BEGIN

                //if 4 digits together

                if (end - (start+1) > 2) {

                    //get first 2 digits as tzhr

                    tzhr = number(s,start+1,start+1+2);

                    // get the rest of digits as tzmin

                    tzmin= number(s,start+1+2, end);

                    start=end;

                } else {

                //CHANGES END

 

                    tzhr = number(s, start+1, end);

                    start = end;

 

                    sep = charAt(s, start);

                    if (sep == ':') {

                        end = firstNonDigit(s, start+1);  // Skip ':'

                        tzmin = number(s, start+1, end);

                        start = end;

                    } else {

                        tzmin = 0;

                    }

                }

              

                // Setting offset does not seem to work correctly in all

                // cases.. So get a fresh calendar for a synthetic timezone

                // instead

                result.tz = getCalendar(tzsign, tzhr, tzmin);

 

                start = skipWhitespace(s, start);  // Skip trailing whitespace

            }

 

 

thanks

 

 

Leon Do

Lucent Technologies

Mobility Software Engineer

 

 

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Support for DatabaseMetadata: getCatalogName, getTableName,
Next
From: Kris Jurka
Date:
Subject: Re: Serbian JDBC translation