You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ma...@apache.org on 2019/08/30 17:17:52 UTC

[archiva] branch master updated: Reducing time resolution for meta artifacts

This is an automated email from the ASF dual-hosted git repository.

martin_s pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/archiva.git


The following commit(s) were added to refs/heads/master by this push:
     new 51171b9  Reducing time resolution for meta artifacts
51171b9 is described below

commit 51171b98a28979bde71377122806e2930bf40cf9
Author: Martin Stockhammer <ma...@apache.org>
AuthorDate: Fri Aug 30 19:16:07 2019 +0200

    Reducing time resolution for meta artifacts
---
 .../java/org/apache/archiva/metadata/model/ArtifactMetadata.java     | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java
index 3ee8ea8..e2fdea2 100644
--- a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java
+++ b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java
@@ -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) {