Subject | Re: XSQLVAR |
---|---|
Author | Blas Rodriguez Somoza |
Post date | 2002-11-04T01:05:46Z |
Hello Roman
I found what seems to be the problem with your version of FBTimestamp and mine.
Although the jdk API docs say that getTime() returns only integral seconds, the j2sdk 1.4.1, which I'm using, return also
milliseconds with Timestamp.getTime(). The difference is that in jdk 1.3.1 and previous, getTime method is the java.util.Date
method, whether in the jdk1.4.1 the method is overrided by a Timestamp method which include milliseconds.
I commit a new version with your change adding getNanos(), but which fill with zero the milliseconds from getTime().
I hope this version works also for you.
Regards
Blas Rodriguez Somoza
I found what seems to be the problem with your version of FBTimestamp and mine.
Although the jdk API docs say that getTime() returns only integral seconds, the j2sdk 1.4.1, which I'm using, return also
milliseconds with Timestamp.getTime(). The difference is that in jdk 1.3.1 and previous, getTime method is the java.util.Date
method, whether in the jdk1.4.1 the method is overrided by a Timestamp method which include milliseconds.
I commit a new version with your change adding getNanos(), but which fill with zero the milliseconds from getTime().
I hope this version works also for you.
Regards
Blas Rodriguez Somoza
----- Original Message -----
From: "Roman Rokytskyy" <rrokytskyy@...>
To: "Blas Rodriguez Somoza" <blas@...>
Sent: Sunday, November 03, 2002 10:01 AM
Subject: Re: XSQLVAR
> Hi,
>
> My fix is related to a bug "precision of timestamp values" in bug tracker (I
> do not remember it's number). In java.sql.Timestamp, getTime() returns only
> time with seconds precision. So this code will fail in second assert:
>
> long time = System.currentTimeMillis();
> java.sql.Timestamp ts = new java.sql.Timestamp(time);
> java.util.Date dt = new java.util.Date(time);
>
> // is ok
> assertTrue("times should be equal.",(ts.getTime() +ts.getNanos() / 1000000)
> == dt.getTime());
>
> // will fail
> assertTrue("times should be equal.", ts.getTime() == dt.getTime());
>
> So, that's the only fix I intended to make. :)
>
> Maybe I was to quick committing it into the CVS, I will check if timestamps
> are stored correctly in database.
>
> What tests fail on your side? Are they in CVS?
>
> Best regards,
> Roman
>
> -------------------------------------------------------------------------
> From: "Blas Rodriguez Somoza" <blas@...>
> Date: Sun, 3 Nov 2002 01:40:50 +0100
> To: "Roman Rokytskyy" <rrokytskyy@...>
> Subj: Re: XSQLVAR
> -------------------------------------------------------------------------
>
> > Hello
> >
> > Excuse me Roman, I intend to mail you about that, and not to commit
> > the code.
> >
> > After you make the change, I found and patch an error in FBTimestamp
> > getString() and getObject(). After that, I run the test and find that with
> > the getNanos() the test fails, and without it succeed.
> >
> > I don't intend to commit before I talk with you, but I make a mistake
> > and commit the code.
> >
> > I suppose that the error you detect is related with the errors in the
> > getString() or getObject() method, but if it is not related with that and
> > my tests fails with the getNanos() and yours fails without it, we have
> > another kind of problem.
> >
> > Regards
> > Blas Rodriguez Somoza.
> >
> > ----- Original Message -----
> > From: "Roman Rokytskyy" <rrokytskyy@...>
> > To: "Blas Rodriguez Somoza" <blas@...>
> > Sent: Saturday, November 02, 2002 8:41 PM
> > Subject: XSQLVAR
> >
> >> Blas,
> >>
> >> I have noticed that you replaced
> >>
> >> return encodeLong(value.getTime() + value.getNanos() / 1000000);
> >>
> >> with
> >>
> >> return encodeLong(value.getTime() );
> >>
> >> in XSQLVAR.encodeTimestamp(Timestamp) method. Why? Is it connected with
> >> bug reports in the group? Thanks! Roman
> >> Rokytskyy ________________________________________________ Do You Yahoo!?
> >> Everything you'll ever need on one web page
> >> from News and Sport to Email and Music Charts
> >> http://uk.my.yahoo.com
> >>
>
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
>