From: | lucas at mcsnw(dot)com (Lucas Madar) |
---|---|
To: | |
Subject: | [Pljava-dev] R: select CURRENT_TIMESTAMP is wrong |
Date: | 2008-01-25 09:14:25 |
Message-ID: | A38F63DA-3A61-4796-8952-7D699433D5B2@mcsnw.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pljava-dev |
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:
--- src/C/pljava/type/Timestamp.c 12 Sep 2007 17:59:43 -0000 1.19
+++ src/C/pljava/type/Timestamp.c 25 Jan 2008 09:04:44 -0000
@@ -14,7 +14,7 @@
#include "pljava/type/Type_priv.h"
#include "pljava/type/Timestamp.h"
-#define EPOCH_DIFF (((uint32)86400) * (POSTGRES_EPOCH_JDATE -
UNIX_EPOCH_JDATE))
+#define EPOCH_DIFF (((uint64)86400) * (POSTGRES_EPOCH_JDATE -
UNIX_EPOCH_JDATE))
/*
* Timestamp type. Postgres will pass (and expect in return) a local
timestamp.
- Lucas Madar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20080125/489b21e7/attachment.html>
From | Date | Subject | |
---|---|---|---|
Next Message | Kris Jurka | 2008-01-25 10:08:14 | [Pljava-dev] R: select CURRENT_TIMESTAMP is wrong |
Previous Message | Jeffrey Lyon | 2008-01-23 13:18:55 | [Pljava-dev] R: select CURRENT_TIMESTAMP is wrong |