On Mon, 31 Aug 2009, ?ubom?r Varga wrote:
> I have noticed imho bad behaviour of add methods for PGInterval class.
> (org.postgresql.util.PGInterval)
>
> First is unlogical adding sum to parameter and not to object on which is
> method invoked. (this is also writen in javadoc, so I accept it)
This is to be similar to the add(Date) and add(Calendar) functions. For
them you wan't to add the interval to the passed object.
> Second, critical for me, is to not using modulo in addition. So if you
> add 55 minutes to 55 minutes, you get 110 minutes instead of 1 hour and
> 50 minutes.
For minutes and hours, it would be OK, but when rolling hours into days or
days into months, context is needed to know if you are near a daylight
saving time change or how many days are in the month. For this reason we
don't manipulate the values and leave them as is.
Kris Jurka