]> granicus.if.org Git - postgresql/commitdiff
Fix to properly handle timezone offsets that are partial hours. If the offset
authorBarry Lind <barry@xythos.com>
Tue, 23 Sep 2003 06:13:52 +0000 (06:13 +0000)
committerBarry Lind <barry@xythos.com>
Tue, 23 Sep 2003 06:13:52 +0000 (06:13 +0000)
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

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

index 1e23fa51afe779468acefaa4c7ad8962b37f8ca6..88f7891d07bbc069f83a671155729b86e64a0f72 100644 (file)
@@ -26,7 +26,7 @@ import java.sql.Timestamp;
 import java.sql.Types;
 import java.util.Vector;
 
-/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.38 2003/09/18 04:14:27 barry Exp $
+/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.39 2003/09/23 06:13:52 barry Exp $
  * This class defines methods of the jdbc1 specification.  This class is
  * extended by org.postgresql.jdbc2.AbstractJdbc2Statement which adds the jdbc2
  * methods.  The real Statement class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Statement
@@ -1245,14 +1245,21 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
                                }
                                else
                                {
-                                       sbuf.append( -l_houros);
+                                       sbuf.append(-l_houros);
                                }
                                int l_minos = l_offset - (l_houros * 60);
                                if (l_minos != 0)
                                {
-                                       if (l_minos < 10)
+                                       if (l_minos > -10 && l_minos < 10)
                                                sbuf.append('0');
-                                       sbuf.append(l_minos);
+                                       if (l_minos >= 0)
+                                       {
+                                               sbuf.append(l_minos);
+                                       }
+                                       else
+                                       {
+                                               sbuf.append(-l_minos);
+                                       }
                                }
                                sbuf.append("'");
                                bind(parameterIndex, sbuf.toString(), PG_TIMESTAMPTZ);