计算间隔时间
文章目录
Instant before = Instant.now();
/*
do something
*/
Instant after = Instant.now();
Duration duration = Duration.between(before, after);
System.out.println("time = " + duration.toMillis() + " ms");Instant before = Instant.now();
/*
do something
*/
Instant after = Instant.now();
Duration duration = Duration.between(before, after);
System.out.println("time = " + duration.toMillis() + " ms");
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论