Re: Date problem on Aix jdk1.4.1 - Mailing list pgsql-jdbc

From Byron Nikolaidis
Subject Re: Date problem on Aix jdk1.4.1
Date
Msg-id 6E0907A94904D94B99D7F387E08C4F570732F1@FALCON.INSIGHT
Whole thread Raw
In response to Date problem on Aix jdk1.4.1  ("Byron Nikolaidis" <ByronN@Routescape.com>)
Responses Re: Date problem on Aix jdk1.4.1
List pgsql-jdbc
Timezone on AIX box is EDT (you can see Calendar below too).

As for the Calendar output,  the values on AIX between rows is identical
(except for the time=1122350400000).      To compare AIX and Windows, I
see a single difference: on Windows the DAY_OF_YEAR=365 compared with
AIX DAY_OF_YEAR=?,  not sure if that means anything?

Can anybody run this test on Aix 5.3, either to confirm they get the
same behavior, or use Java 1.4.2 and verify everything works fine?


AIX:

calendar: id#1
java.util.GregorianCalendar[time=1122350400000,areFieldsSet=false,areAll
FieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/
New_York",offset=-18000000,dstSavings=3600000,useDaylight=true,transitio
ns=139,lastRule=java.util.SimpleTimeZone[id=America/New_York,offset=-180
00000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startM
onth=3,startDay=1,startDayOfWeek=1,startTime=7200000,startTimeMode=0,end
Mode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=7200000,endTimeMode=0
]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2005,MONTH=6,WEE
K_OF_YEAR=1,WEEK_OF_MONTH=5,DAY_OF_MONTH=26,DAY_OF_YEAR=?,DAY_OF_WEEK=4,
DAY_OF_WEEK_IN_MONTH=5,AM_PM=1,HOUR=7,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MI
LLISECOND=0,ZONE_OFFSET=-18000000,DST_OFFSET=0]


Windows: (using jdk1.4.1_07)

Calendar:  id#1
calendar:
java.util.GregorianCalendar[time=1122350400000,areFieldsSet=false,areAll
FieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/
New_York",offset=-18000000,dstSavings=3600000,useDaylight=true,transitio
ns=235,lastRule=java.util.SimpleTimeZone[id=America/New_York,offset=-180
00000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startM
onth=3,startDay=1,startDayOfWeek=1,startTime=7200000,startTimeMode=0,end
Mode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=7200000,endTimeMode=0
]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2005,MONTH=6,WEE
K_OF_YEAR=1,WEEK_OF_MONTH=5,DAY_OF_MONTH=26,DAY_OF_YEAR=365,DAY_OF_WEEK=
4,DAY_OF_WEEK_IN_MONTH=5,AM_PM=1,HOUR=7,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,
MILLISECOND=0,ZONE_OFFSET=-18000000,DST_OFFSET=0]


-----Original Message-----
From: Oliver Jowett [mailto:oliver@opencloud.com]
Sent: Wednesday, July 27, 2005 7:37 PM
To: Byron Nikolaidis
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Date problem on Aix jdk1.4.1

Byron Nikolaidis wrote:
> Here is a really simple test:

> /usr/java14/bin/java -cp "/usr/insight/postgresql.jar:." DateTest
>
> id=1, effective=1122350400000    <---  correct
> id=2, effective=1122354000000    <---   +1 hour
> id=3, effective=1122354000000    <---   all same from here out

It seems ok under 1.4.2 on Linux, with driver build 310, in NZST:

id=1, effective=1122292800000
id=2, effective=1122292800000
id=3, effective=1122292800000

What timezone is the AIX box in exactly? Can you try a 1.4.2 JVM on
there?

The only thing I can think of is some sort of Calendar modification
caused by the first getDate() is carrying over to subsequent calls (the
calendar used is shared between calls), but given that the only thing
that code really touches is the zone/dst offsets, and they're reset each
time, I'm not sure what exactly it would be.

You could try putting something like

  System.err.println("calendar: " + cal);

in org.postgresql.jdbc2.TimestampUtils.toDate() around line 253, just
before the return, and see if there are any notable differences between
the first and second calls..

-O

pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: Date problem on Aix jdk1.4.1
Next
From: Oliver Jowett
Date:
Subject: Re: Date problem on Aix jdk1.4.1