File tree Expand file tree Collapse file tree 3 files changed +49
-0
lines changed
main/java/org/fugerit/java/core/util/checkpoint
test/java/test/org/fugerit/java/core/util/checkpoint Expand file tree Collapse file tree 3 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
88## [ Unreleased]
99
10+ ### Added
11+
12+ - SimpleCheckpoint utility
13+
1014## [ 8.6.0] - 2024-05-09
1115
1216### Added
Original file line number Diff line number Diff line change 1+ package org .fugerit .java .core .util .checkpoint ;
2+
3+ import lombok .Getter ;
4+ import lombok .extern .slf4j .Slf4j ;
5+
6+ @ Slf4j
7+ public class SimpleCheckpoint {
8+
9+ @ Getter
10+ private long baseTime ;
11+
12+ public SimpleCheckpoint () {
13+ this ( System .currentTimeMillis () );
14+ }
15+
16+ public SimpleCheckpoint (long baseTime ) {
17+ this .baseTime = baseTime ;
18+ }
19+
20+ public long getDiffMillis () {
21+ return System .currentTimeMillis () - this .getBaseTime ();
22+ }
23+
24+ public String getFormatTimeDiffMillis () {
25+ return CheckpointUtils .formatTimeDiffMillis ( this .getBaseTime (), System .currentTimeMillis () );
26+ }
27+
28+ }
Original file line number Diff line number Diff line change 1+ package test .org .fugerit .java .core .util .checkpoint ;
2+
3+ import lombok .extern .slf4j .Slf4j ;
4+ import org .fugerit .java .core .util .checkpoint .SimpleCheckpoint ;
5+ import org .junit .Test ;
6+
7+ @ Slf4j
8+ public class TestSimpleCheckpoint {
9+
10+ @ Test
11+ public void testCheckpoint () {
12+ SimpleCheckpoint checkpoint = new SimpleCheckpoint ();
13+ log .info ( "testCheckpoint 1 {}ms" , checkpoint .getDiffMillis () );
14+ log .info ( "testCheckpoint 2 {}ms" , checkpoint .getFormatTimeDiffMillis () );
15+ }
16+
17+ }
You can’t perform that action at this time.
0 commit comments