Patch to set timezone once instead of every call

Started by Barry Lindabout 25 years ago3 messagespatches
Jump to latest
#1Barry Lind
barry@xythos.com

This patch moves the setting of the timezone on the SimpleDateFormat
object inside the initialization section instead of doing it everytime
the setTimestamp method is called. Thanks to Dave Harkness for this
suggestion.

thanks,
--Barry

Attachments:

patch2.difftext/plain; name=patch2.diffDownload+1-1
#2Bruce Momjian
bruce@momjian.us
In reply to: Barry Lind (#1)
Re: Patch to set timezone once instead of every call

Your patch has been added to the PostgreSQL unapplied patches list at:

http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

This patch moves the setting of the timezone on the SimpleDateFormat
object inside the initialization section instead of doing it everytime
the setTimestamp method is called. Thanks to Dave Harkness for this
suggestion.

thanks,
--Barry

*** ./interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java.orig	Sat Jun 30 17:19:36 2001
--- ./interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java	Sat Jun 30 17:20:47 2001
***************
*** 369,377 ****
SimpleDateFormat df = (SimpleDateFormat) tl_tsdf.get();
if(df==null) {
df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
tl_tsdf.set(df);
}
-           df.setTimeZone(TimeZone.getTimeZone("GMT"));
// Use the shared StringBuffer
synchronized(sbuf) {
--- 369,377 ----
SimpleDateFormat df = (SimpleDateFormat) tl_tsdf.get();
if(df==null) {
df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+             df.setTimeZone(TimeZone.getTimeZone("GMT"));
tl_tsdf.set(df);
}

// Use the shared StringBuffer
synchronized(sbuf) {

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#3Bruce Momjian
bruce@momjian.us
In reply to: Barry Lind (#1)
Re: Patch to set timezone once instead of every call

Patch applied. Thanks.

This patch moves the setting of the timezone on the SimpleDateFormat
object inside the initialization section instead of doing it everytime
the setTimestamp method is called. Thanks to Dave Harkness for this
suggestion.

thanks,
--Barry

*** ./interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java.orig	Sat Jun 30 17:19:36 2001
--- ./interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java	Sat Jun 30 17:20:47 2001
***************
*** 369,377 ****
SimpleDateFormat df = (SimpleDateFormat) tl_tsdf.get();
if(df==null) {
df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
tl_tsdf.set(df);
}
-           df.setTimeZone(TimeZone.getTimeZone("GMT"));
// Use the shared StringBuffer
synchronized(sbuf) {
--- 369,377 ----
SimpleDateFormat df = (SimpleDateFormat) tl_tsdf.get();
if(df==null) {
df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+             df.setTimeZone(TimeZone.getTimeZone("GMT"));
tl_tsdf.set(df);
}

// Use the shared StringBuffer
synchronized(sbuf) {

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026