Java Time API - A better way to get total elapsed time
This is my first oportunity to play with the "new" java.time package from Java 8. I need to get the total elapsed time, something like: 1 day, 2h:3m:4s 5ms I know that have 2 TemporalAmount implementations for intervals: - Period for years, months and days - Duration for hours, minutes, seconds, milliseconds and nanoseconds There's a way to mix these two or something more straightforward than "do math"? That was the best I could do until now: (Updated with a new improved version) LocalDateTime start = LocalDateTime.now(); // Forcing a long time execution to measure LocalDateTime end = start