Re: need to update TimestampUtils code

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: "Do, Leon (Leon)" <leondo(at)alcatel-lucent(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: need to update TimestampUtils code
Date: 2007-01-04 21:26:06
Message-ID: FD33D2A9-046F-4664-87FE-5612A0470DEC@fastcrypt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Does the server ever send us hhmm without a colon ?

Or what is the use case for this.

Either way you need to send us a context diff

Dave
On 4-Jan-07, at 2:28 PM, Do, Leon (Leon) wrote:

> 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
>
>
>
>
>
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2007-01-04 21:33:58 Re: need to update TimestampUtils code
Previous Message Kris Jurka 2007-01-04 21:15:48 Re: Support for DatabaseMetadata: getCatalogName, getTableName,