Repository navigation
Conversation
Round epoch milliseconds down to whole seconds before combining them with the original nanosecond fraction. Fixes googleapis#14636
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request simplifies the timestamp conversion logic in Timestamp.of(java.sql.Timestamp) by replacing custom pre-epoch adjustment logic with Math.floorDiv. It also adds a unit test testOf_justBeforeEpoch to verify the correctness of the conversion for timestamps immediately preceding the epoch. There are no review comments, and I have no feedback to provide.
|
I signed the Google Individual CLA, but the rescan link returned HTTP 400 and GitHub still shows the original failed check. Could a Google maintainer please rescan the CLA for this PR? Thanks! |
Converting a SQL timestamp in the last second before the Unix epoch currently moves it one second forward. For example,
1969-12-31T23:59:59.999999999Zbecomes1970-01-01T00:00:00.999999999Z.This change uses
Math.floorDivto round the milliseconds down to whole seconds and keeps the original nanoseconds. The new regression test covers one nanosecond before the epoch. It failed onmainand passed with the fix, along with all 222google-cloud-coretests.Fixes #14636