[pgjdbc/pgjdbc] b56538: fix: date rounding errors for dates before 1970

From: Vladimir Sitnikov <noreply(at)github(dot)com>
To: pgsql-jdbc(at)lists(dot)postgresql(dot)org
Subject: [pgjdbc/pgjdbc] b56538: fix: date rounding errors for dates before 1970
Date: 2019-06-18 19:36:48
Message-ID: pgjdbc/pgjdbc/push/refs/heads/master/45ce14-b56538@github.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Branch: refs/heads/master
Home: https://github.com/pgjdbc/pgjdbc
Commit: b565389920f78702625ee263473bd9b3ec97f764
https://github.com/pgjdbc/pgjdbc/commit/b565389920f78702625ee263473bd9b3ec97f764
Author: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>
Date: 2019-06-18 (Tue, 18 Jun 2019)

Changed paths:
M pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java
M pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimestampTest.java
M pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimezoneTest.java
M pgjdbc/src/test/java/org/postgresql/test/jdbc42/GetObject310Test.java
M pgjdbc/src/test/java/org/postgresql/test/jdbc42/SetObject310Test.java

Log Message:
-----------
fix: date rounding errors for dates before 1970

millis % ONEDAY should be reworked to floorMod(millis, ONEDAY)
Regular division "rounds" towards zero, however that is not what we want for dates
Division "towards zero" results to adding a day for dates with "negative" long values.

So we should use floorDiv/floorMod to get date/time components

see #1499

Browse pgsql-jdbc by date

  From Date Subject
Next Message Vladimir Sitnikov 2019-06-18 20:04:05 [pgjdbc/pgjdbc] 9fcaa9: docs: update translation files
Previous Message Dave Cramer 2019-06-18 12:32:10 [pgjdbc/pgjdbc] 88d1bd: Revert "Fix maven coordinates (#1479)"