<![CDATA[ (…) Instant startTime; Instant endTime; (…) startTime = Instant.now(); (…) // do your processing here (…) endTime = Instant.now(); // <some_class>.<some_static_method> JobLog.incrTime(Duration.between(startTime, endTime).toMillis()); (…) try { difference = JobLog.getTime(); long diffSeconds = difference / 1000 % 60; long diffMinutes = difference / (60 * 1000) % 60; long diffHours = difference / (60 * 60 * 1000) % 24; long diffDays = difference / (24 * 60 * 60 * 1000); System.out.println(); System.out.print(diffDays + " days, “); System.out.print(diffHours + " hours, “); System.out.print(diffMinutes + " minutes, “); System.out.print(diffSeconds + " seconds."); System.out.println(); } catch (ParseException e) { System.out.println(“Unable to calculate processing time. Message: “+e.getMessage()); } ]]>
SyntaxHighlighter.highlight();