pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hartmut Benz <hartmut.benz@ti-wmc.nl>
To: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Small addition to PGInterval
Date: Wed, 11 Apr 2007 12:52:42 +0200
Message-ID: <461CBDFA.6080205@ti-wmc.nl> (raw)
In-Reply-To: <Pine.BSO.4.64.0704110347270.5256@leary.csoft.net>
References: <460BB869.3050200@ti-wmc.nl>
	<Pine.BSO.4.64.0704110347270.5256@leary.csoft.net>

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 :-)

Hartmut Benz


Kris Jurka wrote:
>
>
> On Thu, 29 Mar 2007, Hartmut Benz wrote:
>
>> please find attached a small extension to PGInterval:
>> - getTimeInMillis   - returns the number of milliseconds in the interval
>
> getLengthInMillis doesn't account for months.
>
> ONE_YEAR is seconds in a year instead of milliseconds.
>
> Shouldn't we use the server's definition instead of google's for a 
> year's length in seconds:
> select extract(epoch from '1 year'::interval);
>  date_part
> -----------
>   31557600
> (1 row)
>
>
>> - copying constructor PGInterval(PGInterval) for type-safe, cast-free 
>> cloning
>> - now implements Comaparable<PGInterval>
>
> We can't use generics in this class because it must be buildable with 
> older JDK versions.
>
> Also context diffs (-c) are preferred.
>
> Kris Jurka
>

Attachments:

  PGInterval.diff.gz (application/gzip, 1.1K) download

view thread (6+ messages)  latest in thread

Message-ID: <461CBDFA.6080205@ti-wmc.nl>
Permalink:  ../461CBDFA.6080205@ti-wmc.nl/
Also on:    postgresql.org/message-id/461CBDFA.6080205@ti-wmc.nl

 · 

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: hartmut.benz@ti-wmc.nl, books@ejurka.com
  Subject: Re: Small addition to PGInterval
  In-Reply-To: <461CBDFA.6080205@ti-wmc.nl>
  References: <460BB869.3050200@ti-wmc.nl> <Pine.BSO.4.64.0704110347270.5256@leary.csoft.net> <461CBDFA.6080205@ti-wmc.nl>

* 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