]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.api.acr/src/org/argeo/api/acr/uuid/TimeUuidState.java
1 package org
.argeo
.api
.acr
.uuid
;
3 import java
.time
.Instant
;
4 import java
.time
.ZoneOffset
;
5 import java
.time
.ZonedDateTime
;
8 * The state of a time based UUID generator, as described and discussed in
9 * section 4.2.1 of RFC4122.
11 * @see https://datatracker.ietf.org/doc/html/rfc4122#section-4.2.1
13 public interface TimeUuidState
{
15 /** Start of the Gregorian time, used by time-based UUID (v1). */
16 final static Instant GREGORIAN_START
= ZonedDateTime
.of(1582, 10, 15, 0, 0, 0, 0, ZoneOffset
.UTC
).toInstant();
22 long getClockSequence();
24 static boolean isNoMacAddressNodeId(byte[] nodeId
) {
25 return (nodeId
[0] & 1) != 0;
29 byte[] nodeId
= new byte[6];
33 public byte[] getNodeId() {
37 public void setNodeId(byte[] nodeId
) {
41 public long getLastTimestamp() {
45 public void setLastTimestamp(long lastTimestamp
) {
46 this.lastTimestamp
= lastTimestamp
;
49 public long getClockSequence() {
53 public void setClockSequence(long clockSequence
) {
54 this.clockSequence
= clockSequence
;