AK: Don't show '0 seconds' unless seconds is the only available element

This commit is contained in:
Ali Mohammad Pur 2024-08-06 15:22:34 +02:00 committed by Ali Mohammad Pur
parent f33ea4aae4
commit 6ac71a6623

View file

@ -95,7 +95,8 @@ String human_readable_time(i64 time_in_seconds)
if (minutes > 0)
builder.appendff("{} minute{} ", minutes, minutes == 1 ? "" : "s");
builder.appendff("{} second{}", time_in_seconds, time_in_seconds == 1 ? "" : "s");
if (time_in_seconds > 0 || days + hours + minutes == 0)
builder.appendff("{} second{}", time_in_seconds, time_in_seconds == 1 ? "" : "s");
return MUST(builder.to_string());
}