HomeSoftware Heritage

postgresql: Fix one-by-one error in db_to_date on negative dates

This commit no longer exists in the repository. It may have been part of a branch which was deleted.

Description

postgresql: Fix one-by-one error in db_to_date on negative dates

Using int() on date.timestamp() rounded it up (toward zero),
but the semantics of model.Timestamp is that the actual time is
ts.seconds + ts.microseconds/1000000, so all negative dates were
shifted one second up.

In particular, this causes dates from
1969-12-31T23:59:59.000001 to 1969-12-31T23:59:59.999999
(inclusive) to smash into dates from
1970-01-01T00:00:00.000001 to 1970-01-01T00:00:00.999999,
which is how I discovered the issue.

Details

Provenance
vlorentzAuthored on Dec 9 2021, 4:25 PM
vlorentzPushed on Dec 14 2021, 11:22 AM
Differential Revision
D6825: Add test_revision_add_fractional_timezone
Build Status
Buildable 25616
Build 40055: test-and-buildJenkins console · Jenkins

Commit No Longer Exists

This commit no longer exists in the repository.