Skip to content

Commit 2ec8ee0

Browse files
author
Barry Lind
committed
Fix to properly handle timezone offsets that are partial hours. If the offset
was a partial hour and less than gmt (i.e. -02:30) the code would corrupt the minutes part. Modified Files: jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
1 parent 618d56d commit 2ec8ee0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import java.sql.Types;
2727
import java.util.Vector;
2828

29-
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.38 2003/09/18 04:14:27 barry Exp $
29+
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.39 2003/09/23 06:13:52 barry Exp $
3030
* This class defines methods of the jdbc1 specification. This class is
3131
* extended by org.postgresql.jdbc2.AbstractJdbc2Statement which adds the jdbc2
3232
* methods. The real Statement class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Statement
@@ -1245,14 +1245,21 @@ public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException
12451245
}
12461246
else
12471247
{
1248-
sbuf.append( -l_houros);
1248+
sbuf.append(-l_houros);
12491249
}
12501250
int l_minos = l_offset - (l_houros * 60);
12511251
if (l_minos != 0)
12521252
{
1253-
if (l_minos < 10)
1253+
if (l_minos > -10 && l_minos < 10)
12541254
sbuf.append('0');
1255-
sbuf.append(l_minos);
1255+
if (l_minos >= 0)
1256+
{
1257+
sbuf.append(l_minos);
1258+
}
1259+
else
1260+
{
1261+
sbuf.append(-l_minos);
1262+
}
12561263
}
12571264
sbuf.append("'");
12581265
bind(parameterIndex, sbuf.toString(), PG_TIMESTAMPTZ);

0 commit comments

Comments
 (0)