2016-09-27

Java 8: Not So Poor Man's Timing

import java.time.Duration;
import java.time.Instant;

// ...

Instant start = Instant.now();
// Timed operations come here
Instant stop = Instant.now();
System.out.println("Task ran for: " + Duration.between(start, stop));

I love it.

No comments :

Post a Comment