]> source.dussan.org Git - archiva.git/commitdiff
Reducing time resolution for meta artifacts
authorMartin Stockhammer <martin_s@apache.org>
Fri, 30 Aug 2019 17:16:07 +0000 (19:16 +0200)
committerMartin Stockhammer <martin_s@apache.org>
Fri, 30 Aug 2019 17:17:31 +0000 (19:17 +0200)
archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java

index 3ee8ea8942b6a10e85eadf0e08a0803ae80e15a6..e2fdea2e62bb3ac572d500ad6adaa5ea54c5d96d 100644 (file)
@@ -25,6 +25,8 @@ import org.apache.commons.collections4.bidimap.DualHashBidiMap;
 import javax.xml.bind.annotation.XmlRootElement;
 import java.time.Instant;
 import java.time.ZonedDateTime;
+import java.time.temporal.ChronoUnit;
+import java.time.temporal.TemporalUnit;
 import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
@@ -141,7 +143,8 @@ public class ArtifactMetadata
     }
 
     public void setWhenGathered(ZonedDateTime whenGathered) {
-        this.whenGathered = whenGathered.withZoneSameInstant(ModelInfo.STORAGE_TZ);
+        // We set the resolution to milliseconds, because it's the resolution that all current backends support
+        this.whenGathered = whenGathered.withZoneSameInstant(ModelInfo.STORAGE_TZ).truncatedTo(ChronoUnit.MILLIS);
     }
 
     public void setMd5(String md5) {