File tree Expand file tree Collapse file tree 3 files changed +18
-6
lines changed
src/main/java/com/github/f4b6a3/uuid/factory/standard Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ All notable changes to this project will be documented in this file.
6
6
7
7
Nothing unreleased.
8
8
9
+ ## [ 6.1.1] - 2025-04-13
10
+
11
+ - Fixed incorrect timestamp in UUIDv7 when using user-specified instant. #107
12
+
9
13
## [ 6.1.0] - 2025-03-29
10
14
11
15
- Added microsecond precision to UUIDv7;
@@ -418,7 +422,8 @@ Remove `Fingerprint` // too complex
418
422
- Removed UuidSettings.getNodeIdentifierDeprecated // remove deprecated
419
423
- Renamed UuidSettings to UuidCreatorSettings
420
424
421
- [ unreleased ] : https://github.com/f4b6a3/uuid-creator/compare/uuid-creator-6.1.0...HEAD
425
+ [ unreleased ] : https://github.com/f4b6a3/uuid-creator/compare/uuid-creator-6.1.1...HEAD
426
+ [ 6.1.1 ] : https://github.com/f4b6a3/uuid-creator/compare/uuid-creator-6.1.0...uuid-creator-6.1.1
422
427
[ 6.1.0 ] : https://github.com/f4b6a3/uuid-creator/compare/uuid-creator-6.0.0...uuid-creator-6.1.0
423
428
[ 6.0.0 ] : https://github.com/f4b6a3/uuid-creator/compare/uuid-creator-5.3.7...uuid-creator-6.0.0
424
429
[ 5.3.7 ] : https://github.com/f4b6a3/uuid-creator/compare/uuid-creator-5.3.6...uuid-creator-5.3.7
Original file line number Diff line number Diff line change 44
44
<dependency >
45
45
<groupId >com.github.f4b6a3</groupId >
46
46
<artifactId >uuid-creator</artifactId >
47
- <version >6.1.0 </version >
47
+ <version >6.1.1 </version >
48
48
</dependency >
49
49
```
50
50
Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ public static Builder builder() {
255
255
*/
256
256
@ Override
257
257
public UUID create () {
258
- UUID uuid = this .uuidFunction .apply (instantFunction . get () );
258
+ UUID uuid = this .uuidFunction .apply (null );
259
259
return toUuid (uuid .getMostSignificantBits (), uuid .getLeastSignificantBits ());
260
260
}
261
261
@@ -308,18 +308,25 @@ public UUID apply(final Instant instant) {
308
308
lock .lock ();
309
309
try {
310
310
311
+ if (instant != null ) {
312
+ reset (instant ); // user specified
313
+ return new UUID (this .msb , this .lsb );
314
+ }
315
+
316
+ Instant now = instantFunction .get ();
317
+
311
318
long lastTime = this .lastTime ();
312
- long time = instant .toEpochMilli ();
319
+ long time = now .toEpochMilli ();
313
320
314
321
// is it not too much ahead of system clock?
315
322
if (advanceMax > Math .abs (lastTime - time )) {
316
323
time = Math .max (lastTime , time );
317
324
}
318
325
319
326
if (time == lastTime ) {
320
- increment (instant );
327
+ increment (now );
321
328
} else {
322
- reset (instant );
329
+ reset (now );
323
330
}
324
331
325
332
return new UUID (this .msb , this .lsb );
You can’t perform that action at this time.
0 commit comments