pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Barry Lind <blind@xythos.com>
To: Kim Ho <kho@redhat.com>
Cc: pgsql-jdbc-list <pgsql-jdbc@postgresql.org>
Cc: Fernando Nasser <fnasser@redhat.com>
Cc: Dave Cramer <Dave@micro-automation.net>
Subject: Re: Fix for using JDK1.2 instead of JDK1.4 method in	date/time/timestampToString
Date: Mon, 21 Jul 2003 22:38:59 -0700
Message-ID: <3F1CCDF3.3040006@xythos.com> (raw)
In-Reply-To: <1058452161.20165.12.camel@topanga.toronto.redhat.com>
References: <1058452161.20165.12.camel@topanga.toronto.redhat.com>

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





view thread (5+ messages)

Message-ID: <3F1CCDF3.3040006@xythos.com>
Permalink:  ../3F1CCDF3.3040006@xythos.com/
Also on:    postgresql.org/message-id/3F1CCDF3.3040006@xythos.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: blind@xythos.com, kho@redhat.com, fnasser@redhat.com, Dave@micro-automation.net
  Subject: Re: Fix for using JDK1.2 instead of JDK1.4 method in	date/time/timestampToString
  In-Reply-To: <3F1CCDF3.3040006@xythos.com>
  References: <1058452161.20165.12.camel@topanga.toronto.redhat.com> <3F1CCDF3.3040006@xythos.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox