summaryrefslogtreecommitdiffstats
path: root/usr.bin/w/w.c
diff options
context:
space:
mode:
authorcjc <cjc@FreeBSD.org>2001-09-22 09:33:00 +0000
committercjc <cjc@FreeBSD.org>2001-09-22 09:33:00 +0000
commitb78a2af2f6f5c077ba100abb60e3e4bf0980f5e4 (patch)
tree22f5756e301c514139d7123fb5c86cb198e55a1a /usr.bin/w/w.c
parent2edf22b4470f9876c6af4bafa39f261d9e107ffd (diff)
downloadFreeBSD-src-b78a2af2f6f5c077ba100abb60e3e4bf0980f5e4.zip
FreeBSD-src-b78a2af2f6f5c077ba100abb60e3e4bf0980f5e4.tar.gz
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
Diffstat (limited to 'usr.bin/w/w.c')
-rw-r--r--usr.bin/w/w.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index 2bc15fe..d00713d 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -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;
OpenPOWER on IntegriCloud