Commit 668394ba authored by Kyle Laker's avatar Kyle Laker

whattime: Show 0 minutes in pretty output

When supplying the -p command to uptime, it does not display any
sections where the value is less than 1; however, after a reboot, this
causes the command to just output "up". Showing 0 minutes when the
system has been up for less than a minute makes it clear a reboot just
occurred.
parent 90ac0dab
Pipeline #7205382 passed with stage
in 2 minutes and 7 seconds
......@@ -146,10 +146,10 @@ char *sprint_uptime(int human_readable) {
comma += 1;
}
if (upminutes) {
pos += sprintf(buf + pos, "%s%d %s", comma > 0 ? ", " : "", upminutes,
upminutes > 1 ? "minutes" : "minute");
comma += 1;
if (upminutes || (!upminutes && uptime_secs < 60)) {
pos += sprintf(buf + pos, "%s%d %s", comma > 0 ? ", " : "", upminutes,
upminutes != 1 ? "minutes" : "minute");
comma += 1;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment