File tree 2 files changed +16
-2
lines changed
log4j-core/src/main/java/org/apache/logging/log4j/core/util
2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 16
16
*/
17
17
package org .apache .logging .log4j .core .util ;
18
18
19
+ import java .time .Instant ;
20
+ import org .apache .logging .log4j .core .time .MutableInstant ;
21
+ import org .apache .logging .log4j .core .time .PreciseClock ;
22
+
19
23
/**
20
24
* Implementation of the {@code Clock} interface that returns the system time.
25
+ * @since 2.25
21
26
*/
22
- public final class SystemClock implements Clock {
27
+ public final class SystemClock implements Clock , PreciseClock {
23
28
24
29
/**
25
30
* Returns the system time.
@@ -29,4 +34,13 @@ public final class SystemClock implements Clock {
29
34
public long currentTimeMillis () {
30
35
return System .currentTimeMillis ();
31
36
}
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
+ }
32
46
}
Original file line number Diff line number Diff line change 18
18
* Log4j 2 helper classes.
19
19
*/
20
20
@ Export
21
- @ Version ("2.24.2 " )
21
+ @ Version ("2.25.0 " )
22
22
package org .apache .logging .log4j .core .util ;
23
23
24
24
import org .osgi .annotation .bundle .Export ;
You can’t perform that action at this time.
0 commit comments