From owner-freebsd-bugs Thu Sep 20 4:30: 8 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 4C4AB37B41D for ; Thu, 20 Sep 2001 04:30:03 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f8KBU3R50985; Thu, 20 Sep 2001 04:30:03 -0700 (PDT) (envelope-from gnats) Received: from vbook.express.ru (asplinux.ru [195.133.213.194]) by hub.freebsd.org (Postfix) with ESMTP id C42FA37B409; Thu, 20 Sep 2001 04:20:03 -0700 (PDT) Received: from vova by vbook.express.ru with local (Exim 3.31 #2) id 15k1tE-0000r2-00; Thu, 20 Sep 2001 15:21:08 +0400 Message-Id: Date: Thu, 20 Sep 2001 15:21:08 +0400 From: "Vladimir B.Grebenschikov" Reply-To: "Vladimir B.Grebenschikov" To: FreeBSD-gnats-submit@freebsd.org Cc: freebsd-hackers@freebsd.org X-Send-Pr-Version: 3.113 Subject: bin/30680: uptime and w utilities lie about real uptime Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 30680 >Category: bin >Synopsis: uptime and w utilities lie about real uptime >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Sep 20 04:30:03 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Vladimir B. Grebenschikov >Release: FreeBSD 5.0-CURRENT i386 >Organization: TSB "Russian Express" >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; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message