java计时器StopWatch
请求接口时有时需要知道请求时间,所以用到stopwatch
导入jar包
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
public static void main(String[] args) { //创建并启动StopWatch StopWatch stopwatch = StopWatch.createStarted(); try{ //主体代码
Thread.sleep(2000); }finally{ stopwatch.stop(); }; System.out.println(stopwatch); }

浙公网安备 33010602011771号