From: Dave Cramer <pg@fastcrypt.com>
To: Do, Leon (Leon) <leondo@alcatel-lucent.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: need to update TimestampUtils code
Date: Thu, 4 Jan 2007 16:26:06 -0500
Message-ID: <FD33D2A9-046F-4664-87FE-5612A0470DEC@fastcrypt.com> (raw)
In-Reply-To: <D1EE06BA46B1E4449AF9A4F2FBEE18615E3021@ILEXC2U01.ndc.lucent.com>
References: <D1EE06BA46B1E4449AF9A4F2FBEE18615E3021@ILEXC2U01.ndc.lucent.com>
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
>
>
>
>
>
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: pg@fastcrypt.com, leondo@alcatel-lucent.com
Subject: Re: need to update TimestampUtils code
In-Reply-To: <FD33D2A9-046F-4664-87FE-5612A0470DEC@fastcrypt.com>
References: <D1EE06BA46B1E4449AF9A4F2FBEE18615E3021@ILEXC2U01.ndc.lucent.com> <FD33D2A9-046F-4664-87FE-5612A0470DEC@fastcrypt.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox