pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: Ľubomír Varga <luvar@plaintext.sk>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Possible bug in PGInterval class
Date: Tue, 1 Sep 2009 20:01:11 -0400 (EDT)
Message-ID: <alpine.BSO.2.00.0909011954290.14550@leary.csoft.net> (raw)
In-Reply-To: <200908312134.12661.luvar@plaintext.sk>
References: <200908312134.12661.luvar@plaintext.sk>



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



view thread (4+ messages)  latest in thread

Message-ID: <alpine.BSO.2.00.0909011954290.14550@leary.csoft.net>
Permalink:  ../alpine.BSO.2.00.0909011954290.14550@leary.csoft.net/
Also on:    postgresql.org/message-id/alpine.BSO.2.00.0909011954290.14550@leary.csoft.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: books@ejurka.com, luvar@plaintext.sk
  Subject: Re: Possible bug in PGInterval class
  In-Reply-To: <alpine.BSO.2.00.0909011954290.14550@leary.csoft.net>
  References: <200908312134.12661.luvar@plaintext.sk> <alpine.BSO.2.00.0909011954290.14550@leary.csoft.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox