You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2026/03/19 14:44:51 UTC

(jackrabbit-oak) branch OAK-12067b created (now f57ecfdf60)

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

reschke pushed a change to branch OAK-12067b
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


      at f57ecfdf60 OAK-12067: Utils.alignWithExternalRevisions logs timestamps with second resolution (in 1.22)

This branch includes the following new commits:

     new f57ecfdf60 OAK-12067: Utils.alignWithExternalRevisions logs timestamps with second resolution (in 1.22)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(jackrabbit-oak) 01/01: OAK-12067: Utils.alignWithExternalRevisions logs timestamps with second resolution (in 1.22)

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

reschke pushed a commit to branch OAK-12067b
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit f57ecfdf603ef9ea1a60d6e9e5f7a08dd9498025
Author: Julian Reschke <ju...@gmx.de>
AuthorDate: Thu Mar 19 15:44:29 2026 +0100

    OAK-12067: Utils.alignWithExternalRevisions logs timestamps with second resolution (in 1.22)
---
 .../jackrabbit/oak/plugins/document/util/Utils.java     | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java
index 8c2ce28e68..e766423415 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java
@@ -22,10 +22,11 @@ import java.nio.charset.Charset;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.sql.Timestamp;
+import java.time.Instant;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -1046,7 +1047,9 @@ public class Utils {
             LOG.warn("Detected clock differences. Local time is '{}', " +
                             "while most recent external time is '{}'. " +
                             "Current _lastRev entries: {}",
-                    new Date(localTime), new Date(externalTime), lastRevMap.values());
+                    asISO8601(localTime),
+                    asISO8601(externalTime),
+                    lastRevMap.values());
             double delay = ((double) externalTime - localTime) / 1000d;
             String fmt = "Background read will be delayed by %.1f seconds. " +
                     "Please check system time on cluster nodes.";
@@ -1134,4 +1137,14 @@ public class Utils {
             throw new DocumentStoreException(msg);
         }
     }
+
+    /**
+     * Formats the epoch time in milliseconds as ISO-8601 in UTC.
+     *
+     * @param ms the time in milliseconds.
+     * @return date format for the time in milliseconds.
+     */
+    public static String asISO8601(long ms) {
+        return DateTimeFormatter.ISO_INSTANT.format(Instant.ofEpochMilli(ms));
+    }
 }