Returns the smallest valid time UUID that is greater than the specified time uuid based on
{@link UUID#compareTo(java.util.UUID)}}, or <code>null</code> if the uuid is greater than or
equal to {@link #maximumUuid()}.
501446
public static UUID getNext(UUID uuid) {
        checkArgument(uuid.version() == 1, "Not a time UUID");
        UUID max = maximumUuid();
        long lsb = uuid.getLeastSignificantBits();
        if (lsb < max.getLeastSignificantBits()) {
            return new UUID(uuid.getMostSignificantBits(), lsb + 1);
        }
        long timestamp = uuid.timestamp();
        if (timestamp < max.timestamp()) {
            return new UUID(getMostSignificantBits(timestamp + 1), minimumUuid().getLeastSignificantBits());
        }
        return null;  // No next exists since uuid == maximumUuid()
    }
66982
private int getTimeSlice(Instant timestamp) {
        long value = times.getTime(timestamp) / TIMESLICE_INTERVAL;
        if (value>Integer.MAX_VALUE || value<0) throw new IllegalArgumentException("Timestamp overflow detected: " + timestamp);
        return (int)value;
    }
106602
private long findHighestId() {
        return this.registeredServices.stream().map(RegisteredService::getId).max(Comparator.naturalOrder()).orElse(0L);
    }
602055
def nil_uuid?
      return false if self.time_low != 0
      return false if self.time_mid != 0
      return false if self.time_hi_and_version != 0
      return false if self.clock_seq_hi_and_reserved != 0
      return false if self.clock_seq_low != 0
      self.nodes.each do |node|
        return false if node != 0
      end
      return true
    end
107944
public static <T> com.simiacryptus.util.lang.TimedResult<T> time(@javax.annotation.Nonnull final UncheckedSupplier<T> fn) {
    long priorGcMs = ManagementFactory.getGarbageCollectorMXBeans().stream().mapToLong(x -> x.getCollectionTime()).sum();
    final long start = System.nanoTime();
    @Nullable T result = null;
    try {
      result = fn.get();
    } catch (@javax.annotation.Nonnull final RuntimeException e) {
      throw e;
    } catch (@javax.annotation.Nonnull final Exception e) {
      throw new RuntimeException(e);
    }
    long wallClockTime = System.nanoTime() - start;
    long gcTime = ManagementFactory.getGarbageCollectorMXBeans().stream().mapToLong(x -> x.getCollectionTime()).sum() - priorGcMs;
    return new com.simiacryptus.util.lang.TimedResult<T>(result, wallClockTime, gcTime);
  }
939809
public static java.util.UUID getUniqueTimeUUIDinMillis() {
        return new java.util.UUID(UUIDGen.newTime(), UUIDGen.getClockSeqAndNode());
    }
1096419
public T get(final UUID _uuid)
    {
        return getCache4UUID() == null ? null : getCache4UUID().get(_uuid);
    }
1029569
public static Timestamp getTimeStamp(String time) {
	if (time.equalsIgnoreCase("now")) {
	    return Timestamp.now();
	} else {
	    int quantity = 0;
	    String unit = "";
	    Pattern lastNUnitsPattern = Pattern
		    .compile(
			    "last\\s*(\\d*)\\s*(min|mins|hour|hours|day|days|week|weeks).*",
			    Pattern.CASE_INSENSITIVE);
	    Matcher lastNUnitsMatcher = lastNUnitsPattern.matcher(time);
	    while (lastNUnitsMatcher.find()) {
		quantity = "".equals(lastNUnitsMatcher.group(1)) ? 1 : Integer
			.valueOf(lastNUnitsMatcher.group(1));
		unit = lastNUnitsMatcher.group(2).toLowerCase();
		switch (unit) {
		case "min":
		case "mins":
		    return Timestamp.now().minus(
			    TimeDuration.ofMinutes(quantity));
		case "hour":
		case "hours":
		    return Timestamp.now()
			    .minus(TimeDuration.ofHours(quantity));
		case "day":
		case "days":
		    return Timestamp.now().minus(
			    TimeDuration.ofHours(quantity * 24));
		case "week":
		case "weeks":
		    return Timestamp.now().minus(
			    TimeDuration.ofHours(quantity * 24 * 7));
		default:
		    break;
		}
	    }

	    Pattern nUnitsAgoPattern = Pattern
		    .compile(
			    "(\\d*)\\s*(min|mins|hour|hours|day|days|week|weeks)\\s*ago",
			    Pattern.CASE_INSENSITIVE);
	    Matcher nUnitsAgoMatcher = nUnitsAgoPattern.matcher(time);
	    while (nUnitsAgoMatcher.find()) {
		quantity = "".equals(nUnitsAgoMatcher.group(1)) ? 1 : Integer
			.valueOf(nUnitsAgoMatcher.group(1));
		unit = nUnitsAgoMatcher.group(2).toLowerCase();
		switch (unit) {
		case "min":
		case "mins":
		    return Timestamp.now().minus(
			    TimeDuration.ofMinutes(quantity));

		case "hour":
		case "hours":
		    return Timestamp.now()
			    .minus(TimeDuration.ofHours(quantity));
		case "day":
		case "days":
		    return Timestamp.now().minus(
			    TimeDuration.ofHours(quantity * 24));
		case "week":
		case "weeks":
		    return Timestamp.now().minus(
			    TimeDuration.ofHours(quantity * 24 * 7));
		default:
		    break;
		}
	    }
	    TimestampFormat format = new TimestampFormat(
		    "yyyy-MM-dd'T'HH:mm:ss");
	    try {
		return format.parse(time);
	    } catch (ParseException e) {
		return null;
	    }
	}
    }
415480
public static UUID maximumUuid() {
        return new UUID(getMostSignificantBits(Long.MAX_VALUE),
                getLeastSignificantBits(Integer.MAX_VALUE, Long.MAX_VALUE));
    }
816827
private static long timeFromQualifier(final byte[] qualifier, 
      final long base_time) {
    final long offset;
    if (qualifier.length == 3) {
      offset = Bytes.getUnsignedShort(qualifier, 1);
      return (base_time + offset) * 1000;
    } else {
      offset = Bytes.getUnsignedInt(qualifier, 1);
      return (base_time * 1000) + offset;
    }
  }
1072126
public long maxTimestamp()
  {
    return ranges == null
            ? topLevel.markedForDeleteAt
            : Math.max(topLevel.markedForDeleteAt, ranges.maxMarkedAt());
  }
335413
public static String getUUID() {
        long timeInSeconds = new Date().getTime();
        String randomChars = TestCase.getRandomString(10);
        return timeInSeconds + "_" + randomChars;
    }
664051
private static <T extends Comparable<? super T>> Observable<T> minMax(
            Observable<T> source, final int flag) {
        return minMax(source, OnSubscribeMinMax.COMPARABLE_MIN, flag);
    }
1240817
@Override
  public int compareTo(@Nonnull TimeAndDimsPointer rhs)
  {
    long timestamp = getTimestamp();
    long rhsTimestamp = rhs.getTimestamp();
    int timestampDiff = Long.compare(timestamp, rhsTimestamp);
    if (timestampDiff != 0) {
      return timestampDiff;
    }
    for (int dimIndex = 0; dimIndex < dimensionSelectors.length; dimIndex++) {
      int dimDiff = dimensionSelectorComparators[dimIndex].compare(
          dimensionSelectors[dimIndex],
          rhs.dimensionSelectors[dimIndex]
      );
      if (dimDiff != 0) {
        return dimDiff;
      }
    }
    return 0;
  }
268764
public boolean update(final V value, final long maxTime, final TimeUnit timeUnit) {
        final K key = keyOf(value);
        if (key != null) {
            return collectionWithWriteTimeout(maxTime, timeUnit)
                    .replaceOne(byId(key), encode(value))
                    .getModifiedCount() == 1;
        } else {
            throw new IllegalArgumentException("Key must not be null");
        }
    }
522060
public EasyRandomParameters timeRange(final LocalTime min, final LocalTime max) {
        if (min.isAfter(max)) {
            throw new IllegalArgumentException("Min time should be before max time");
        }
        setTimeRange(new Range<>(min, max));
        return this;
    }
561055
public long getNextUniqueTransactionId() {
        // get the current time, usually the salt value is zero
        // in testing it is used to simulate clock skew
        long currentTime = m_clock.get() + m_timestampTestingSalt;
        if (currentTime == lastUsedTime) {
            // increment the counter for this millisecond
            counterValue++;

            // handle the case where we've run out of counter values
            // for this particular millisecond (feels unlikely)
            if (counterValue > COUNTER_MAX_VALUE) {
                // spin until the next millisecond
                while (currentTime == lastUsedTime) {
                    currentTime = m_clock.get();
                }
                // reset the counter and lastUsedTime for the new millisecond
                lastUsedTime = currentTime;
                counterValue = 0;
            }
        }
        else {
            // reset the counter and lastUsedTime for the new millisecond
            if (currentTime < lastUsedTime) {
                VoltLogger log = new VoltLogger("HOST");
                double diffSeconds = (lastUsedTime - currentTime) / 1000.0;
                String msg = String.format("Initiator time moved backwards from: %d to %d, a difference of %.2f seconds.",
                        lastUsedTime, currentTime, diffSeconds);
                log.error(msg);
                System.err.println(msg);
                // if the diff is less than some specified amount of time, wait a bit
                if ((lastUsedTime - currentTime) < BACKWARD_TIME_FORGIVENESS_WINDOW_MS) {
                    log.info("This node will delay any stored procedures sent to it.");
                    log.info(String.format("This node will resume full operation in  %.2f seconds.", diffSeconds));

                    long count = BACKWARD_TIME_FORGIVENESS_WINDOW_MS;
                    // note, the loop should stop once lastUsedTime is PASSED, not current
                    while ((currentTime <= lastUsedTime) && (count-- > 0)) {
                        try {
                            m_clock.sleep(1);
                        } catch (InterruptedException e) {}
                        currentTime = m_clock.get();
                    }
                    // if the loop above ended because it ran too much
                    if (count < 0) {
                        org.voltdb.VoltDB.crashLocalVoltDB(
                              "VoltDB was unable to recover after the system time was externally negatively adusted. " +
                               "It is possible that there is a serious system time or NTP error. ", false, null);
                    }
                }
                // crash immediately if time has gone backwards by too much
                else {
                    org.voltdb.VoltDB.crashLocalVoltDB(
                            String.format("%.2f is larger than the max allowable number of seconds that " +
                                    "the clock can be negatively adjusted (%d)",
                                diffSeconds, BACKWARD_TIME_FORGIVENESS_WINDOW_MS / 1000), false, null);
                }
            }
            lastUsedTime = currentTime;
            counterValue = 0;
        }

        lastTxnId = makeIdFromComponents(currentTime, counterValue, initiatorId);

        return lastTxnId;
    }