16842: Truncate nanoseconds from timestamps in index response.
authorTom Clegg <tom@tomclegg.ca>
Wed, 16 Sep 2020 18:02:33 +0000 (14:02 -0400)
committerTom Clegg <tom@tomclegg.ca>
Wed, 16 Sep 2020 20:33:50 +0000 (16:33 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@tomclegg.ca>

services/keepstore/s3_volume.go

index 235d369b5a67f780fb1cb29794ed65294b7a150c..07bb033c9f1fbc551c34fc59a3a89656cfbf7d79 100644 (file)
@@ -586,7 +586,10 @@ func (v *S3Volume) IndexTo(prefix string, writer io.Writer) error {
                if err != nil {
                        return err
                }
-               fmt.Fprintf(writer, "%s+%d %d\n", data.Key, data.Size, t.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, t.Unix()*1000000000)
        }
        return dataL.Error()
 }