16842: Truncate timestamp precision in new S3 driver, too.
authorTom Clegg <tom@tomclegg.ca>
Thu, 17 Sep 2020 13:20:16 +0000 (09:20 -0400)
committerTom Clegg <tom@tomclegg.ca>
Thu, 17 Sep 2020 13:20:16 +0000 (09:20 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@tomclegg.ca>

services/keepstore/s3aws_volume.go

index c9fa7fce5e3fe8b2c8e7e42589766792d1bbb640..d07d23c3c219c630f61881bf75df1d233f0b67a6 100644 (file)
@@ -728,7 +728,10 @@ func (v *S3AWSVolume) IndexTo(prefix string, writer io.Writer) error {
                if err := recentL.Error(); err != nil {
                        return err
                }
-               fmt.Fprintf(writer, "%s+%d %d\n", *data.Key, *data.Size, stamp.LastModified.UnixNano())
+               // We truncate sub-second precision here. Otherwise
+               // timestamps will never match the RFC1123-formatted
+               // Last-Modified values parsed by Mtime().
+               fmt.Fprintf(writer, "%s+%d %d\n", *data.Key, *data.Size, stamp.LastModified.Unix()*1000000000)
        }
        return dataL.Error()
 }