Skip to content
Snippets Groups Projects
Commit 4e84b763 authored by Chris Larsen's avatar Chris Larsen
Browse files

[core] Change the RemainingFormatter to reflect non-plural times, fixing #825.

NOTE if you parse the standard out of YCSB, you'll be missing the "s" sometimes.
parent d6e57c3f
No related branches found
No related tags found
No related merge requests found
......@@ -331,25 +331,25 @@ final class RemainingFormatter {
StringBuilder time = new StringBuilder();
long days = TimeUnit.SECONDS.toDays(seconds);
if (days > 0) {
time.append(days).append(" days ");
time.append(days).append(days == 1 ? " day " : " days ");
seconds -= TimeUnit.DAYS.toSeconds(days);
}
long hours = TimeUnit.SECONDS.toHours(seconds);
if (hours > 0) {
time.append(hours).append(" hours ");
time.append(hours).append(hours == 1 ? " hour " : " hours ");
seconds -= TimeUnit.HOURS.toSeconds(hours);
}
/* Only include minute granularity if we're < 1 day. */
if (days < 1) {
long minutes = TimeUnit.SECONDS.toMinutes(seconds);
if (minutes > 0) {
time.append(minutes).append(" minutes ");
time.append(minutes).append(minutes == 1 ? " minute " : " minutes ");
seconds -= TimeUnit.MINUTES.toSeconds(seconds);
}
}
/* Only bother to include seconds if we're < 1 minute */
if (time.length() == 0) {
time.append(seconds).append(" seconds ");
time.append(seconds).append(time.length() == 1 ? " second " : " seconds ");
}
return time;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment