乐趣区

关于java:计算间隔时间

Instant before = Instant.now();

/*
do something
*/

Instant after = Instant.now();
Duration duration = Duration.between(start, end);
System.out.println("time =" + duration.toMillis() + "ms");
退出移动版