]> granicus.if.org Git - procps-ng/commit
library: suppress zero 'days' under the <uptime.h> API
authorJim Warner <james.warner@comcast.net>
Fri, 4 Sep 2015 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Sun, 6 Sep 2015 11:59:17 +0000 (21:59 +1000)
commit34395be330484999874f4478957e2dd143473fe7
tree1f067e932ca6ea746354f7b5996e67ee3e82da4d
parentbb04019510a97e7ead25892a62361ee51d552a3a
library: suppress zero 'days' under the <uptime.h> API

The former whattime logic used to suppress that 'days'
output when the system had been up less than 24 hours.

But since the refactor for newlib, '0 days' was always
output under those conditions. So this commit restores
the former expected behavior of suppressing that item.

[ plus an erroneous calculation of uphours was fixed ]

[ and the clang warnings shown below were also fixed ]

Reference(s):
proc/uptime.c:74:10: warning: unused variable 'buf' [-Wunused-variable]
    char buf[256];
         ^
proc/uptime.c:131:58: warning: data argument not used by format string [-Wformat-extra-args]
        pos += sprintf(upbuf + pos, "%d min, ", uphours, upminutes);
                                    ~~~~~~~~~~           ^
proc/uptime.c:175:15: warning: expression result unused [-Wunused-value]
        comma +1;
        ~~~~~ ^~

Signed-off-by: Jim Warner <james.warner@comcast.net>
proc/uptime.c