如何在 java 中创建一个保存 ntp 时间值的 uuid 参数

how to create a uuid parameter in java which holds the value of ntp time

我必须创建一个 uuid 类型的参数,但这里的问题是这个 uuid 参数应该包含 ntp timeinteger

的组合值
import org.apache.commons.net.ntp.TimeStamp;
import java.util.*;

public class NtpTest {

public static void main(String[] args) {
    Integer value = new Integer(8);
    TimeStamp ntp = TimeStamp.getCurrentTime();
    // Here I have to create a UUID parameter by combining these value and ntp 
   // I tried with fllowing but got Invalid UUID string error
    UUID uid = UUID.fromString(value+ntp.toString()); 
}

没有得到确切的解决方案,但尝试了一些研究,最终找到了将 ntp timestamp 转换为 UUID

import java.util.*;

import org.apache.commons.net.ntp.TimeStamp;

public class NtpToUuid {

public static void main(String[] args) {
    TimeStamp t2 = TimeStamp.getCurrentTime();
    UUID uuid3 = com.datastax.driver.core.utils.UUIDs.startOf(t2.getTime());
    System.out.println("UUID3 : "+uuid3);
        }
}