library: more mem and stat fixes

Make distcheck now succeeds.
Changed some of the binaries to use the new API.
This commit is contained in:
Craig Small
2015-06-24 22:16:16 +10:00
parent 05efbebb66
commit cbf25b93e3
11 changed files with 118 additions and 260 deletions

View File

@ -111,16 +111,14 @@ PROCPS_EXPORT char *sprint_uptime(void)
if (time(&realseconds) < 0)
return upbuf;
realtime = localtime(&realseconds);
pos = sprintf(upbuf, " %02d:%02d:%02d ",
realtime->tm_hour, realtime->tm_min, realtime->tm_sec);
if (uptime(&uptime_secs, &idle_secs) < 0)
return upbuf;
updays = ((int) uptime_secs / (60*60*24));
uphours = ((int) uptime_secs / (60*24)) % 24;
uphours = ((int) uptime_secs / (60*60)) % 24;
upminutes = ((int) uptime_secs / (60)) % 60;
pos = sprintf(upbuf, "%02d:%02d:%02d up %d %s, ",
pos = sprintf(upbuf, " %02d:%02d:%02d up %d %s, ",
realtime->tm_hour, realtime->tm_min, realtime->tm_sec,
updays, (updays != 1) ? "days" : "day");
if (uphours)