Return a 128-bit version of the given time and sequence numbers according
to the Flake specification.

@param time     a time value to encode
@param sequence a sequence value to encode
@return the Flake id as bytes
341409
@Override
    public byte[] encodeAsBytes(long time, int sequence) {
        byte[] buffer = new byte[16];
        buffer[0] = (byte) (time >>> 56);
        buffer[1] = (byte) (time >>> 48);
        buffer[2] = (byte) (time >>> 40);
        buffer[3] = (byte) (time >>> 32);
        buffer[4] = (byte) (time >>> 24);
        buffer[5] = (byte) (time >>> 16);
        buffer[6] = (byte) (time >>> 8);
        buffer[7] = (byte) (time);

        long rest = shiftedMachineId | (0x0000FFFF & sequence);
        buffer[8] = (byte) (rest >>> 56);
        buffer[9] = (byte) (rest >>> 48);
        buffer[10] = (byte) (rest >>> 40);
        buffer[11] = (byte) (rest >>> 32);
        buffer[12] = (byte) (rest >>> 24);
        buffer[13] = (byte) (rest >>> 16);
        buffer[14] = (byte) (rest >>> 8);
        buffer[15] = (byte) (rest);

        return buffer;
    }
280356
public M sequence(String sequenceKey, SequenceConfig sequenceConfig) {
        getSequence(sequenceKey, firstNonNull(sequenceConfig, defaultSequenceConfig()));
        return THIS();
    }
26064
public static long getDelayMillis(String time) {
		String pattern = "HH:mm";
		Date now = new Date();
		if (StringUtils.contains(time, "-")) {
			String start = time.split("-")[0];
			String end = time.split("-")[1];
			if (StringUtils.contains(start, ":") && StringUtils.contains(end, ":")) {
				Date d1 = getCurrentDateByPlan(start, pattern);
				Date d2 = getCurrentDateByPlan(end, pattern);
				while (d1.before(now)) {
					d1 = DateUtils.addDays(d1, 1);
				}

				while (d2.before(d1)) {
					d2 = DateUtils.addDays(d2, 1);
				}

				return RandomUtil.nextLong(d1.getTime() - now.getTime(), d2.getTime() - now.getTime());
			}
		} else if (StringUtils.isNumeric(time)) {
			return Long.parseLong(time);
		}

		// default
		return getDelayMillis("02:00-05:00");
	}
791037
public static int convertStringToTimeSeconds(String time) {
        int result = 0;
        if (time.endsWith("H")) {
            int hoursToAdd = Integer.valueOf(StringUtils.remove(time, 'H'));
            result = (60 * 60) * hoursToAdd;
        } else if (time.endsWith("M")) {
            int minsToAdd = Integer.valueOf(StringUtils.remove(time, 'M'));
            result = 60 * minsToAdd;
        } else if (time.endsWith("S")) {
            int secsToAdd = Integer.valueOf(StringUtils.remove(time, 'S'));
            result = secsToAdd;
        }
        return result;
    }
426650
public long getSequenceID()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getSequenceID");
    long sequenceID=0;
    sequenceID = msgItem.getMessage().getGuaranteedValueValueTick();

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getSequenceID", new Long(sequenceID));
    return sequenceID;
  }
823087
function getDynamoDBSequenceNumber(record) {
  return record && record.dynamodb && record.dynamodb.SequenceNumber ? record.dynamodb.SequenceNumber : '';
}
14198
public static Date decodeDate(byte[] flakeBytes) {
        ByteBuffer buffer = ByteBuffer.allocate(16);
        buffer.put(flakeBytes);
        buffer.flip();
        return new Date(buffer.getLong());
    }
906228
def btc_tx_der_encode_sequence(*encoded_pieces):
    
    # borrowed from python-ecdsa
    total_len = sum([len(p) for p in encoded_pieces])
    return b('\x30') + btc_tx_der_encode_length(total_len) + b('').join(encoded_pieces)
858792
public static String toDateString(long time) {
		GregorianCalendar cal = new GregorianCalendar(0, 0, 0);
		cal.setTimeInMillis(time);
		return toDateString(cal);
	}
718169
public synchronized Long generateId() {
        if (sequenceBlock == null || !sequenceBlock.hasNext()) {
            sequenceBlock = allocateSequenceBlock();
        }
        return sequenceBlock.next();
    }
1197758
public static java.sql.Time toSqlTime(String time) {
		java.util.Date newDate = toDate("1/1/1970", time);

		if (newDate != null)
			return new java.sql.Time(newDate.getTime());
		else
			return null;
	}
1240350
public static final SimpleMutableDateTime now(Clock clock)
    {
        ZonedDateTime zdt = ZonedDateTime.now(clock);
        SimpleMutableDateTime smt = SimpleMutableDateTime.from(zdt);
        return smt;
    }
71068
public static <S extends Sequence<C>, C extends Compound> String getIDFormat(List<S> sequences) {
		int length = 0;
		for (S as : sequences) {
			length = Math.max(length, (as.getAccession() == null) ? 0 : as.getAccession().toString().length());
		}
		return (length == 0) ? null : "%-" + (length + 1) + "s";
	}
1224243
public static int toUnix(String time, String pattern) {
        LocalDateTime formatted = LocalDateTime.parse(time, DateTimeFormatter.ofPattern(pattern));
        return (int) formatted.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond();
    }
749001
public long nextUniqueTransaction(long timeMs) {
        long id = timeMs;
        for (; ; ) {
            long old = transactionID.get();
            if (old >= id)
                id = old + 1;
            if (transactionID.compareAndSet(old, id))
                break;
        }
        return id;
    }
310198
def generate_nonce_timestamp():
    
    global count
    rng = botan.rng().get(30)
    uuid4 = uuid.uuid4().bytes  # 16 byte
    tmpnonce = (bytes(str(count).encode('utf-8'))) + uuid4 + rng
    nonce = tmpnonce[:41]  # 41 byte (328 bit)
    count += 1
    return nonce
485029
public String getSequence(Long beginPosition, Long endPosition)
	{
		byte[] sequenceByte = getSequenceByte(beginPosition, endPosition);
		if (sequenceByte != null)
			return new String(sequenceByte);
		return null;
	}