File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
log4j-core/src/main/java/org/apache/logging/log4j/core/util Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1616 */
1717package org .apache .logging .log4j .core .util ;
1818
19+ import java .time .Instant ;
20+ import org .apache .logging .log4j .core .time .MutableInstant ;
21+ import org .apache .logging .log4j .core .time .PreciseClock ;
22+
1923/**
2024 * Implementation of the {@code Clock} interface that returns the system time.
25+ * @since 2.25
2126 */
22- public final class SystemClock implements Clock {
27+ public final class SystemClock implements Clock , PreciseClock {
2328
2429 /**
2530 * Returns the system time.
@@ -29,4 +34,13 @@ public final class SystemClock implements Clock {
2934 public long currentTimeMillis () {
3035 return System .currentTimeMillis ();
3136 }
37+
38+ /**
39+ * {@inheritDoc}
40+ */
41+ @ Override
42+ public void init (final MutableInstant mutableInstant ) {
43+ final Instant instant = java .time .Clock .systemUTC ().instant ();
44+ mutableInstant .initFromEpochSecond (instant .getEpochSecond (), instant .getNano ());
45+ }
3246}
Original file line number Diff line number Diff line change 1818 * Log4j 2 helper classes.
1919 */
2020@ Export
21- @ Version ("2.24.2 " )
21+ @ Version ("2.25.0 " )
2222package org .apache .logging .log4j .core .util ;
2323
2424import org .osgi .annotation .bundle .Export ;
You can’t perform that action at this time.
0 commit comments