[Pljava-dev] R: select CURRENT_TIMESTAMP is wrong

From: books at ejurka(dot)com (Kris Jurka)
To:
Subject: [Pljava-dev] R: select CURRENT_TIMESTAMP is wrong
Date: 2008-01-25 10:08:14
Message-ID: Pine.BSO.4.64.0801250502210.7084@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

On Fri, 25 Jan 2008, Lucas Madar wrote:

> I didn't post this to the list by mistake, but I found a solution. It appears
> that some precision is being lost with certain compilers. The culprit is
> this:
> mSecs += EPOCH_DIFF * 1000; /* Adjust for diff
> between Postgres and Java (Unix) */
>
> EPOCH_DIFF is cast as an int32; multiplying it by 1000 yields some 949
> billion. Here's a fix:
>
> +#define EPOCH_DIFF (((uint64)86400) * (POSTGRES_EPOCH_JDATE -
> UNIX_EPOCH_JDATE))
>

I'm not sure what the implications of this change are. I see this
existing code for the reverse operation and think we should mirror that
instead:

src/C/pljava/type/Timestamp.c:97

mSecs -= ((jlong)EPOCH_DIFF) * 1000L;

Kris Jurka

PS: I'm aware of your other reports, but I just haven't found the time to
look into them. Keep things coming and we'll get to them eventually.

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message asim naseem 2008-01-29 21:39:42 [Pljava-dev] org.postgresql.util.PSQLException: ERROR: could not load library "/usr/local/pgsql/data1/pljava.so": libjvm.so: cannot open shared object file: No such file or directory
Previous Message Lucas Madar 2008-01-25 09:14:25 [Pljava-dev] R: select CURRENT_TIMESTAMP is wrong