计算间隔时间

Instant before = Instant.now();

/*
do something
*/

Instant after = Instant.now();
Duration duration = Duration.between(before, after);
System.out.println("time = " + duration.toMillis() + " ms");

评论

暂无评论