From: Vladimir Sitnikov <noreply@github.com>
To: pgsql-jdbc@lists.postgresql.org
Subject: [pgjdbc/pgjdbc] b56538: fix: date rounding errors for dates before 1970
Date: Tue, 18 Jun 2019 12:36:48 -0700
Message-ID: <pgjdbc/pgjdbc/push/refs/heads/master/45ce14-b56538@github.com> (raw)
Branch: refs/heads/master
Home: https://github.com/pgjdbc/pgjdbc
Commit: b565389920f78702625ee263473bd9b3ec97f764
https://github.com/pgjdbc/pgjdbc/commit/b565389920f78702625ee263473bd9b3ec97f764
Author: Vladimir Sitnikov <sitnikov.vladimir@gmail.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
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: noreply@github.com
Subject: Re: [pgjdbc/pgjdbc] b56538: fix: date rounding errors for dates before 1970
In-Reply-To: <pgjdbc/pgjdbc/push/refs/heads/master/45ce14-b56538@github.com>
References: <pgjdbc/pgjdbc/push/refs/heads/master/45ce14-b56538@github.com>
* 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