Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id A33A49FA4B4 for ; Thu, 4 Jan 2007 17:26:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 76382-06 for ; Thu, 4 Jan 2007 17:26:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by postgresql.org (Postfix) with SMTP id 921279FA131 for ; Thu, 4 Jan 2007 17:26:07 -0400 (AST) Received: (qmail 20420 invoked from network); 4 Jan 2007 21:26:05 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.14?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 4 Jan 2007 21:26:05 -0000 In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: multipart/alternative; boundary=Apple-Mail-3-660206006 Message-Id: Cc: From: Dave Cramer Subject: Re: need to update TimestampUtils code Date: Thu, 4 Jan 2007 16:26:06 -0500 To: "Do, Leon (Leon)" X-Mailer: Apple Mail (2.752.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/28 X-Sequence-Number: 16393 --Apple-Mail-3-660206006 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed 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 > > > > > > --Apple-Mail-3-660206006 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 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=A0

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

Hi,=A0

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? =A0The code allow the util to parse the timezone = in both format hhmm or hh:mm. =A0=A0

=A0

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 // Possibly = read timezone.

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 sep =3D charAt(s, = start);=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 if (sep =3D=3D '-' || sep =3D=3D '+') {=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 int tzsign =3D (sep =3D=3D '-') ? -1 : = 1;=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 int tzhr, tzmin;

=A0=A0=A0

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

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 = //CHANGES BEGIN

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 //if 4 digits = together=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 if (end - (start+1) > 2) {=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 //get first 2 digits as = tzhr=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 tzhr =3D = number(s,start+1,start+1+2);

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 // get the rest of digits as tzmin

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

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 start=3Dend;

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 } else = {=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 //CHANGES END

=A0

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

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 start =3D end;

=A0=A0=A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0sep= =3D charAt(s, start);

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 if (sep =3D=3D ':') {

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

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 start =3D end;

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 = =A0=A0=A0=A0=A0} else {

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 tzmin =3D 0;

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 }=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 }

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0<= O:P style=3D"font-family: Arial; font-size: 13.3333px; = ">

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

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 // cases.. So = get a fresh calendar for a synthetic timezone=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 // instead

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

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 = start =3D skipWhitespace(s, start);=A0 // Skip trailing = whitespace=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 }

thanks

Leon Do

Lucent Technologies

Mobility Software = Engineer


= --Apple-Mail-3-660206006--