Re: Small addition to PGInterval - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: Small addition to PGInterval
Date
Msg-id Pine.BSO.4.64.0704110704480.1156@leary.csoft.net
Whole thread Raw
In response to Re: Small addition to PGInterval  (Hartmut Benz <hartmut.benz@ti-wmc.nl>)
Responses Re: Small addition to PGInterval  (Hartmut Benz <hartmut.benz@ti-wmc.nl>)
List pgsql-jdbc

On Wed, 11 Apr 2007, Hartmut Benz wrote:

> Thanks for pointing this out. I corrected the bug (months) and use the server
> definition for both year and month. It is a bit problematic to determine the
> 'correct' number of seconds in these kind of intervals because there are so
> many of them :-)

Does getLengthInMillis have any external value or is it solely useful for
implementing compareTo?  I fear that people will try to do something like:

Date d = new Date();
PGInterval i = new PGInterval("1 year");
d.setTime(d.getTime() + i.getLengthInMillis());

instead of using the exising i.add(d) method.  As you mention it's not
entirely clear what value it should be returning, so I'd prefer not to
expose it unless you have a more useful use case.

Kris Jurka

pgsql-jdbc by date:

Previous
From: Hartmut Benz
Date:
Subject: Re: Small addition to PGInterval
Next
From: "Xavier Poinsard"
Date:
Subject: Re: Prepared statement parameter and timestamp