Re: Bug in the setTimestamp() method for Newfoundland time

From: Barry Lind <blind(at)xythos(dot)com>
To: Brent Eagles <brent(dot)eagles(at)iona(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Bug in the setTimestamp() method for Newfoundland time
Date: 2003-09-23 06:16:02
Message-ID: 3F6FE522.40600@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Brent,

This is now fixed in current cvs. Thanks for the bug report.

--Barry

Brent Eagles wrote:
> Hi,
>
> The Statement.setTimestamp() implementation has a bug in it for half
> hour timezones west of GMT. Newfoundland is such a location with a
> timezone offset of GMT -3:30. An example of a bogus string (calc
> includes Daylight savings time offset) follows:
>
> 2003-07-15 10:43:35.000000-020-30
>
> The problem is in here:
>
> int l_minos = l_offset - (l_houros * 60);
> if (l_minos != 0)
> {
> if (l_minos < 10)
> sbuf.append('0');
> sbuf.append(l_minos);
> }
>
> l_minos is going to be negative so 1. a zero is going to erroneously be
> inserted into the stream and 2. the neg sign is going to be included in
> sbuf.append(l_minos).
>
> A possible fix is to modify the code like so:
>
> if (l_minos != 0)
> {
> l_minos = Math.abs(l_minos);
> if (l_minos < 10)
> sbuf.append('0');
> sbuf.append(l_minos);
> }
>
>
> Best regards,
>
> Brent
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Chris Faulkner 2003-09-23 13:49:43 authentication
Previous Message Joseph Shraibman 2003-09-23 02:39:46 ResultSet getXXX methods