diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtil.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/VersionUtil.java similarity index 75% rename from org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtil.java rename to org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/VersionUtil.java index c9e6a99a7..b4ad10a4c 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtil.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/VersionUtil.java @@ -1,4 +1,4 @@ -package org.hl7.fhir.utilities; +package org.hl7.fhir.r5.validation; /* * #%L @@ -21,8 +21,16 @@ package org.hl7.fhir.utilities; */ import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.time.Duration; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.util.Date; import java.util.Properties; +import org.hl7.fhir.r5.model.InstantType; +import org.hl7.fhir.utilities.Utilities; + import static org.apache.commons.lang3.StringUtils.defaultIfBlank; import static org.apache.commons.lang3.StringUtils.left; @@ -73,7 +81,17 @@ public class VersionUtil { } public static String getVersionString() { - return "Version " + getVersion() + " - Built " + getBuildTime() + " - Git " + left(getBuildNumber(), 12); + return "Version " + getVersion() + " (Git# " + left(getBuildNumber(), 12)+"). Built " + getBuildTime() + " ("+getDurationSinceBuild()+")"; } + private static String getDurationSinceBuild() { + try { + InstantType dt = new InstantType(ourBuildTime); + return Utilities.describeDuration(Duration.ofMillis(new Date().getTime() - dt.getValue().getTime()))+" old"; + } catch (Exception e) { + return "??"; + } + } + + }