Page MenuHomeSoftware Heritage

Fix normalize_timestamp() for datetime < epoch with microsecond>0
ClosedPublic

Authored by douardda on Jun 15 2021, 10:44 AM.

Details

Summary

the problem was for datetime<epoch, the timestamp is negative, but since
it's a float that includes the microseconds, if both are true (< epoch
and microsecond > 0), then the computed (int) timestamp was off by one.

Add dedicated tests for this.

Diff Detail

Event Timeline

Build has FAILED

Patch application report for D5868 (id=21008)

Rebasing onto ae50e43fe0...

Current branch diff-target is up to date.
Changes applied before test
commit 171246dae112447a97e9ad742ad13546e0667da5
Author: David Douard <david.douard@sdfa3.org>
Date:   Tue Jun 15 10:39:21 2021 +0200

    Fix normalize_timestamp() for datetime < epoch with microsecond>0
    
    the problem was for datetime<epoch, the timestamp is negative, but since
    it's a float that includes the microseconds, if both are true (< epoch
    and microsecond > 0), then the computed (int) timestamp was off by one.
    
    Add dedicated tests for this.

Link to build: https://jenkins.softwareheritage.org/job/DMOD/job/tests-on-diff/347/
See console output for more information: https://jenkins.softwareheritage.org/job/DMOD/job/tests-on-diff/347/console

Harbormaster returned this revision to the author for changes because remote builds failed.Jun 15 2021, 10:46 AM
Harbormaster failed remote builds in B21986: Diff 21008!

attempt to make the test local-tz independant...

Build is green

Patch application report for D5868 (id=21011)

Rebasing onto ae50e43fe0...

Current branch diff-target is up to date.
Changes applied before test
commit 428c170496ef53f6602bc35ab0c9b60fea8996e4
Author: David Douard <david.douard@sdfa3.org>
Date:   Tue Jun 15 10:39:21 2021 +0200

    Fix normalize_timestamp() for datetime < epoch with microsecond>0
    
    the problem was for datetime<epoch, the timestamp is negative, but since
    it's a float that includes the microseconds, if both are true (< epoch
    and microsecond > 0), then the computed (int) timestamp was off by one.
    
    Add dedicated tests for this.

See https://jenkins.softwareheritage.org/job/DMOD/job/tests-on-diff/349/ for more details.

This revision is now accepted and ready to land.Jun 15 2021, 12:14 PM