Fixing a bug that causes very short uptimes (less than one minute) to

be 30 seconds off. (Thanks to Vladimir B.Grebenschikov
<vova@express.ru> for the PR and ru for a more elegant fix.)

PR:		bin/30680
Approved by:	ru
This commit is contained in:
cjc 2001-09-22 09:33:00 +00:00
parent 2edf22b447
commit b78a2af2f6

View File

@ -452,7 +452,8 @@ pr_header(nowp, nusers)
if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 &&
boottime.tv_sec != 0) {
uptime = now - boottime.tv_sec;
uptime += 30;
if (uptime > 60)
uptime += 30;
days = uptime / 86400;
uptime %= 86400;
hrs = uptime / 3600;