From b78a2af2f6f5c077ba100abb60e3e4bf0980f5e4 Mon Sep 17 00:00:00 2001 From: cjc Date: Sat, 22 Sep 2001 09:33:00 +0000 Subject: Fixing a bug that causes very short uptimes (less than one minute) to be 30 seconds off. (Thanks to Vladimir B.Grebenschikov for the PR and ru for a more elegant fix.) PR: bin/30680 Approved by: ru --- usr.bin/w/w.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'usr.bin/w/w.c') 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; -- cgit v1.1