]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org/argeo/api/uuid/TimeUuidState.java
1 package org
.argeo
.api
.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();
20 long getClockSequence();
22 static boolean isNoMacAddressNodeId(byte[] nodeId
) {
23 return (nodeId
[0] & 1) != 0;
30 public long getLastTimestamp() {
34 public void setLastTimestamp(long lastTimestamp
) {
35 this.lastTimestamp
= lastTimestamp
;
38 public long getClockSequence() {
42 public void setClockSequence(long clockSequence
) {
43 this.clockSequence
= clockSequence
;