From b7856f885bf02af20b07359823396a92ffa6e76e Mon Sep 17 00:00:00 2001
From: Ivan Frade <ifrade@google.com>
Date: Tue, 12 Nov 2024 12:29:13 -0800
Subject: [PATCH] SystemReader: add method to get LocalDateTime

Using #civilNow() because in the documentation, this calendar-based
representation is called "civil time".

Change-Id: Iaa363e66683cb548419666068a4ffef44a776e12
---
 .../src/org/eclipse/jgit/util/SystemReader.java      | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java
index 7cdf0ee1a..55cc878e0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java
@@ -26,6 +26,7 @@
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.time.Instant;
+import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.time.ZoneOffset;
 import java.util.Locale;
@@ -538,6 +539,17 @@ public Instant now() {
 		return Instant.ofEpochMilli(getCurrentTime());
 	}
 
+	/**
+	 * Get "now" as civil time, in the System timezone
+	 *
+	 * @return the current system time
+	 *
+	 * @since 7.1
+	 */
+	public LocalDateTime civilNow() {
+		return LocalDateTime.ofInstant(now(), getTimeZoneId());
+	}
+
 	/**
 	 * Get clock instance preferred by this system.
 	 *
-- 
GitLab