Add interface to time with try-with-resources