Re: Fix for using JDK1.2 instead of JDK1.4 method in date/time/timestampToString - Mailing list pgsql-jdbc

From Barry Lind
Subject Re: Fix for using JDK1.2 instead of JDK1.4 method in date/time/timestampToString
Date
Msg-id 3F1CCDF3.3040006@xythos.com
Whole thread Raw
In response to Fix for using JDK1.2 instead of JDK1.4 method in date/time/timestampToString  (Kim Ho <kho@redhat.com>)
List pgsql-jdbc
Patch applied.

--Barry


Kim Ho wrote:
> Uses a slightly longer method of getting the rawoffset and then adding
> the DST offset if any.
>
> Cheers,
>
> Kim
>
>
>
>
> ------------------------------------------------------------------------
>
> ? temp.diff
> Index: Makefile
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/Makefile,v
> retrieving revision 1.38
> diff -c -p -r1.38 Makefile
> *** Makefile    12 Feb 2003 06:13:04 -0000    1.38
> --- Makefile    17 Jul 2003 14:23:09 -0000
> ***************
> *** 4,10 ****
>   #
>   # Copyright (c) 2001, PostgreSQL Global Development Group
>   #
> ! # $Header: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/Makefile,v 1.38 2003/02/12 06:13:04 barry Exp $
>   #
>   #-------------------------------------------------------------------------
>
> --- 4,10 ----
>   #
>   # Copyright (c) 2001, PostgreSQL Global Development Group
>   #
> ! # $Header: /cvsroot/pgsql-server/src/interfaces/jdbc/Makefile,v 1.38 2003/02/12 06:13:04 barry Exp $
>   #
>   #-------------------------------------------------------------------------
>
> Index: org/postgresql/jdbc1/AbstractJdbc1Statement.java
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java,v
> retrieving revision 1.27
> diff -c -p -r1.27 AbstractJdbc1Statement.java
> *** org/postgresql/jdbc1/AbstractJdbc1Statement.java    9 Jul 2003 05:12:04 -0000    1.27
> --- org/postgresql/jdbc1/AbstractJdbc1Statement.java    17 Jul 2003 14:23:11 -0000
> *************** public abstract class AbstractJdbc1State
> *** 2072,2078 ****
>           if (timezoneLocation>7 && timezoneLocation+3 == s.length())
>           {
>               timezone = Integer.parseInt(s.substring(timezoneLocation+1,s.length()));
> !             localoffset = java.util.Calendar.getInstance().getTimeZone().getOffset(millis);
>               if (s.charAt(timezoneLocation)=='+')
>                   timezone*=-1;
>           }
> --- 2072,2081 ----
>           if (timezoneLocation>7 && timezoneLocation+3 == s.length())
>           {
>               timezone = Integer.parseInt(s.substring(timezoneLocation+1,s.length()));
> ! //            localoffset = java.util.Calendar.getInstance().getTimeZone().getOffset(millis);
> !             localoffset = java.util.Calendar.getInstance().getTimeZone().getRawOffset();
> !             if (java.util.Calendar.getInstance().getTimeZone().inDaylightTime(new java.sql.Date(millis)))
> !                 localoffset += 60*60*1000;
>               if (s.charAt(timezoneLocation)=='+')
>                   timezone*=-1;
>           }
> *************** public abstract class AbstractJdbc1State
> *** 2101,2107 ****
>           if (timezoneLocation != -1 && timezoneLocation+3 == s.length())
>           {
>               timezone = Integer.parseInt(s.substring(timezoneLocation+1,s.length()));
> !             localoffset = java.util.Calendar.getInstance().getTimeZone().getOffset(millis);
>               if (s.charAt(timezoneLocation)=='+')
>                   timezone*=-1;
>           }
> --- 2104,2113 ----
>           if (timezoneLocation != -1 && timezoneLocation+3 == s.length())
>           {
>               timezone = Integer.parseInt(s.substring(timezoneLocation+1,s.length()));
> ! //            localoffset = java.util.Calendar.getInstance().getTimeZone().getOffset(millis);
> !             localoffset = java.util.Calendar.getInstance().getTimeZone().getRawOffset();
> !             if (java.util.Calendar.getInstance().getTimeZone().inDaylightTime(new java.sql.Time(millis)))
> !                 localoffset += 60*60*1000;
>               if (s.charAt(timezoneLocation)=='+')
>                   timezone*=-1;
>           }
> *************** public abstract class AbstractJdbc1State
> *** 2146,2152 ****
>           if (timezoneLocation>8 && timezoneLocation+3 == s.length())
>           {
>               timezone = Integer.parseInt(s.substring(timezoneLocation+1,s.length()));
> !             localoffset = java.util.Calendar.getInstance().getTimeZone().getOffset(millis);
>               if (s.charAt(timezoneLocation)=='+')
>                   timezone*=-1;
>           }
> --- 2152,2161 ----
>           if (timezoneLocation>8 && timezoneLocation+3 == s.length())
>           {
>               timezone = Integer.parseInt(s.substring(timezoneLocation+1,s.length()));
> ! //            localoffset = java.util.Calendar.getInstance().getTimeZone().getOffset(millis);
> !             localoffset = java.util.Calendar.getInstance().getTimeZone().getRawOffset();
> !             if (java.util.Calendar.getInstance().getTimeZone().inDaylightTime(new java.sql.Timestamp(millis)))
> !                 localoffset += 60*60*1000;
>               if (s.charAt(timezoneLocation)=='+')
>                   timezone*=-1;
>           }
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org



pgsql-jdbc by date:

Previous
From: Dmitry Tkach
Date:
Subject: Re: Prepared Statements
Next
From: Dmitry Tkach
Date:
Subject: Re: Prepared Statements