MCPcopy Create free account
hub / github.com/apache/nutch / elapsedTime

Method elapsedTime

src/java/org/apache/nutch/util/TimingUtil.java:37–59  ·  view source on GitHub ↗

Calculate the elapsed time between two times specified in milliseconds. @param start The start of the time period @param end The end of the time period @return a string of the form "XhYmZs" when the elapsed time is X hours, Y minutes and Z seconds or null if start > end

(long start, long end)

Source from the content-addressed store, hash-verified

35 * minutes and Z seconds or null if start > end.
36 */
37 public static String elapsedTime(long start, long end) {
38 if (start > end) {
39 return null;
40 }
41
42 long[] elapsedTime = new long[TIME_FACTOR.length];
43
44 for (int i = 0; i < TIME_FACTOR.length; i++) {
45 elapsedTime[i] = start > end ? -1 : (end - start) / TIME_FACTOR[i];
46 start += TIME_FACTOR[i] * elapsedTime[i];
47 }
48
49 NumberFormat nf = NumberFormat.getInstance(Locale.ROOT);
50 nf.setMinimumIntegerDigits(2);
51 StringBuffer buf = new StringBuffer();
52 for (int i = 0; i < elapsedTime.length; i++) {
53 if (i > 0) {
54 buf.append(":");
55 }
56 buf.append(nf.format(elapsedTime[i]));
57 }
58 return buf.toString();
59 }
60}

Callers 6

fetchMethod · 0.95
parseMethod · 0.95
injectMethod · 0.95
updateTableMethod · 0.95
generateMethod · 0.95
runMethod · 0.95

Calls 3

getInstanceMethod · 0.65
appendMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected