5
5
6
6
import java .time .Duration ;
7
7
import java .util .Arrays ;
8
- import java .util .Locale ;
9
8
import java .util .function .Function ;
10
9
import java .util .stream .Stream ;
11
10
@@ -30,7 +29,7 @@ public enum Fields {
30
29
EXECUTED_CACHEABLE_DURATION ("Executed cacheable duration" , d -> totalDuration (d , "executed_cacheable" )),
31
30
EXECUTED_NOT_CACHEABLE ("Executed not cacheable" , d -> totalTasks (d , "executed_not_cacheable" )),
32
31
EXECUTED_NOT_CACHEABLE_DURATION ("Executed not cacheable duration" , d -> totalDuration (d , "executed_not_cacheable" )),
33
- EFFECTIVE_TASK_EXECUTION_DURATION ("Effective task execution duration" , d -> String . valueOf (d .getEffectiveTaskExecutionDuration (). toMillis ())),
32
+ EFFECTIVE_TASK_EXECUTION_DURATION ("Effective task execution duration" , d -> formatDuration (d .getEffectiveTaskExecutionDuration ())),
34
33
;
35
34
36
35
public final String label ;
@@ -76,19 +75,6 @@ private static String totalDuration(BuildValidationData data, String avoidanceOu
76
75
}
77
76
78
77
private static String formatDuration (Duration duration ) {
79
- long hours = duration .toHours ();
80
- long minutes = duration .minusHours (hours ).toMinutes ();
81
- double seconds = duration .minusHours (hours ).minusMinutes (minutes ).toMillis () / 1000d ;
82
-
83
- StringBuilder s = new StringBuilder ();
84
- if (hours != 0 ) {
85
- s .append (hours + "h " );
86
- }
87
- if (minutes != 0 ) {
88
- s .append (minutes + "m " );
89
- }
90
- s .append (String .format (Locale .ROOT , "%.3fs" , seconds ));
91
-
92
- return s .toString ().trim ();
78
+ return String .valueOf (duration .toMillis ());
93
79
}
94
80
}
0 commit comments