-// clockSequence = new AtomicInteger(secureRandom.nextInt(MAX_CLOCKSEQUENCE));
- hardwareAddress = getHardwareAddress();
-
- macAddressTimeUuidState = hardwareAddress != null
- ? new ConcurrentTimeUuidState(hardwareAddress, 0, secureRandom, clock)
- : null;
- defaultTimeUuidState = nodeId != null ? new ConcurrentTimeUuidState(nodeId, offset, secureRandom, clock)
- : macAddressTimeUuidState != null ? macAddressTimeUuidState
- // we use random as a last resort
- : new ConcurrentTimeUuidState(null, -1, secureRandom, clock);
-
- // GREGORIAN_START = ZonedDateTime.of(1582, 10, 15, 0, 0, 0, 0, ZoneOffset.UTC);
-// Duration duration = Duration.between(TimeUuidState.GREGORIAN_START, Instant.now());
-// long nowVm = System.nanoTime() / 100;
-// startTimeStamp = (duration.getSeconds() * 10000000 + duration.getNano() / 100) - nowVm;
+ byte[] hardwareAddress = getHardwareAddress();
+// macAddressNodeId = hardwareAddress != null ? new NodeId(hardwareAddress, 0) : null;
+ macAddressNodeId = toNodeId(hardwareAddress, 0);
+
+// defaultNodeId = nodeId != null ? new NodeId(nodeId, offset) : macAddressNodeId;
+ defaultNodeId = nodeId != null ? toNodeId(nodeId, offset) : toNodeId(macAddressNodeId, 0);
+ if (defaultNodeId == null)
+ throw new IllegalStateException("No default node id specified");
+
+ timeUuidState = new ConcurrentTimeUuidState(secureRandom, clock);