Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D42B16335C3 for ; Tue, 1 Sep 2009 21:01:21 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 32449-05 for ; Wed, 2 Sep 2009 00:01:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail.postgresql.org (Postfix) with ESMTP id E9EC6634603 for ; Tue, 1 Sep 2009 21:01:13 -0300 (ADT) Received: by leary.csoft.net (Postfix, from userid 1112) id 04FFCA320; Tue, 1 Sep 2009 20:01:11 -0400 (EDT) Date: Tue, 1 Sep 2009 20:01:11 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: =?ISO-8859-2?Q?=A5ubom=EDr_Varga?= cc: pgsql-jdbc@postgresql.org Subject: Re: Possible bug in PGInterval class In-Reply-To: <200908312134.12661.luvar@plaintext.sk> Message-ID: References: <200908312134.12661.luvar@plaintext.sk> User-Agent: Alpine 2.00 (BSO 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200909/1 X-Sequence-Number: 19948 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