java 计算接口的请求的时间

思路都是将date转成long类型进行减操作

方法一:

LocalDateTime beginTime = LocalDateTime.now();

Long timeConsuming = Duration.between(between,LocalDateTime.now()).toMillis();

方法二:

Long beginTime = new Date().getTime();

Long totalConsumedTime=new Date().getTime()-beginTime;

 

你可能感兴趣的:(javase)