Timer
Mos
Using Instant and Duration from Java 8's new API,
Instant start = Instant.now(); Thread.sleep(5000); Instant end = Instant.now(); System.out.println(Duration.between(start, end));
outputs,
PT5S