Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Sep 2001 15:21:08 +0400
From:      Vladimir B.Grebenschikov <vova@express.ru>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        freebsd-hackers@freebsd.org
Subject:   uptime and w utilities lie about real uptime
Message-ID:  <E15k1tE-0000r2-00@vbook.express.ru>

next in thread | raw e-mail | index | archive | help

>Submitter-Id:	current-users
>Originator:	Vladimir B. Grebenschikov
>Organization:	TSB "Russian Express"
>Confidential:	no 
>Synopsis:	uptime and w utilities lie about real uptime
>Severity:	non-critical
>Priority:	low
>Category:	bin
>Class:		sw-bug
>Release:	FreeBSD 5.0-CURRENT i386
>Environment:
System: FreeBSD vbook.express.ru 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Wed Sep 19 20:26:25 MSD 2001 root@vbook.express.ru:/usr/src.local/sys/i386/compile/VBOOK i386

>Description:

	Just after very fast boot uptimealways shows more than 30 sec.

	looking to src/usr/bin/w/w.c:

        if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 &&
            boottime.tv_sec != 0) {
                uptime = now - boottime.tv_sec;
                uptime += 30;
====================== ^^^^^
                days = uptime / 86400;
                uptime %= 86400;
                hrs = uptime / 3600;
                uptime %= 3600;
                mins = uptime / 60;
                secs = uptime % 60;
                (void)printf(" up");


why utility increases uptime on 30 seconds ??
Is any real reasons for it ?

>How-To-Repeat:
	Boot and run uptime
>Fix:

--- src/usr.bin/w.c.orig    Thu Sep 20 15:20:01 2001
+++ src/usr.bin/w.c Thu Sep 20 15:20:11 2001
@@ -450,7 +450,6 @@
        if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 &&
            boottime.tv_sec != 0) {
                uptime = now - boottime.tv_sec;
-               uptime += 30;
                days = uptime / 86400;
                uptime %= 86400;
                hrs = uptime / 3600;

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E15k1tE-0000r2-00>