mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-25 20:11:18 +00:00
Avoid passing too many arguments to String.format
This commit is contained in:
parent
ec0611d7cf
commit
c9c46b00e3
@ -45,9 +45,7 @@ class HumanDuration {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
long time = duration;
|
||||
final long ms = time % 1000L;
|
||||
time = time / 1000;
|
||||
long time = duration / 1000;
|
||||
final long sec = time % 60;
|
||||
time = time / 60;
|
||||
final long min = time % 60;
|
||||
@ -55,15 +53,15 @@ class HumanDuration {
|
||||
final long hour = time % 24;
|
||||
final long day = time / 24;
|
||||
if (day > 0) {
|
||||
return String.format("%dd %02dh%02dm%02ds", day, hour, min, sec, ms);
|
||||
return String.format("%dd %02dh%02dm%02ds", day, hour, min, sec);
|
||||
}
|
||||
if (hour > 0) {
|
||||
return String.format("%dh%02dm%02ds", hour, min, sec, ms);
|
||||
return String.format("%dh%02dm%02ds", hour, min, sec);
|
||||
}
|
||||
if (min > 0) {
|
||||
return String.format("%dm%02ds", min, sec, ms);
|
||||
return String.format("%dm%02ds", min, sec);
|
||||
}
|
||||
return String.format("%ds", sec, ms);
|
||||
return String.format("%ds", sec);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user