From owner-freebsd-hackers Thu Sep 20 4:44:31 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mx.wgate.com (mail.wgate.com [38.219.83.4]) by hub.freebsd.org (Postfix) with SMTP id 3E9FE37B410 for ; Thu, 20 Sep 2001 04:44:25 -0700 (PDT) To: "Vladimir B.Grebenschikov" Cc: FreeBSD-gnats-submit@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG Received: From MAIL.TVOL.NET (10.1.1.4[10.1.1.4 port:3933]) by mx.wgate.comMail essentials (server 2.429) with SMTP id: <6978@mx.wgate.com>transfer for ; Thu, 20 Sep 2001 7:43:09 AM -0400 ;transfer smtpmailfrom X-MESINK_Inbound: 0 X-MESINK_MailForType: SMTP X-MESINK_SenderType: SMTP X-MESINK_Sender: msinz@wgate.com X-MESINK_MailFor: freebsd-hackers@FreeBSD.ORG Received: from sinz.eng.tvol.net ([10.32.2.99]) by mail.tvol.net with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13)id THV3CRM7; Thu, 20 Sep 2001 07:43:00 -0400 Received: from wgate.com (localhost [127.0.0.1])by sinz.eng.tvol.net (8.11.6/8.11.6) with ESMTP id f8KBi6s93355;Thu, 20 Sep 2001 07:44:06 -0400 (EDT)(envelope-from msinz@wgate.com) Date: Thu, 20 Sep 2001 07:44:06 -0400 From: Michael Sinz Organization: WorldGate Communications Inc. X-Mailer: Mozilla 4.76 [en] (X11; U; FreeBSD 4.3-STABLE i386) X-Accept-Language: en Subject: Re: uptime and w utilities lie about real uptime References: <400de87e0423b007d1@[192.168.1.4]> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit x-receiver: freebsd-hackers@FreeBSD.ORG x-sender: msinz@wgate.com MIME-Version: 1.0 Message-ID: <402390ae04246407d1@[192.168.1.4]> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG "Vladimir B.Grebenschikov" wrote: > > >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 ? From my reading of this, it seems to want to round the uptime to the nearest minute -- afterall, w and uptime both only show the uptime in minutes (well, days, hours, and minutes) -- Michael Sinz ---- Worldgate Communications ---- msinz@wgate.com A master's secrets are only as good as the master's ability to explain them to others. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message