From owner-freebsd-questions Sat Mar 28 07:22:03 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA27436 for freebsd-questions-outgoing; Sat, 28 Mar 1998 07:22:03 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from spinner.netplex.com.au (spinner.netplex.com.au [202.12.86.3]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA27375; Sat, 28 Mar 1998 07:21:57 -0800 (PST) (envelope-from peter@netplex.com.au) Received: from spinner.netplex.com.au (localhost [127.0.0.1]) by spinner.netplex.com.au (8.8.8/8.8.8/Spinner) with ESMTP id XAA11722; Sat, 28 Mar 1998 23:21:36 +0800 (WST) (envelope-from peter@spinner.netplex.com.au) Message-Id: <199803281521.XAA11722@spinner.netplex.com.au> X-Mailer: exmh version 2.0.2 2/24/98 To: Michael Richards cc: freebsd-questions@FreeBSD.ORG, freebsd-bugs@FreeBSD.ORG Subject: Re: Login accounting design In-reply-to: Your message of "Fri, 27 Mar 1998 20:58:06 -0400." Date: Sat, 28 Mar 1998 23:21:34 +0800 From: Peter Wemm Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Michael Richards wrote: > Hi. I noticed something a little weird... > > [root@frodo /root]# ac -p > root 0.56 > ftp 0.02 > miker 0.22 > jon 11.00 > total 11.80 > [root@frodo /root]# ac -p > root 0.56 > ftp 0.02 > miker 0.22 > jon 11.00 > total 11.81 > [root@frodo /root]# ac -p > root 0.57 > ftp 0.02 > miker 0.22 > jon 11.00 > total 11.81 > > Someone can't add :) Well, maybe this was a 1 in a million thing where I > happened to run the command and inbetween cpu cycles, the time changed, > but I would think that the order of commands would be arranged such that > the number added to the entry at the username would be the same number > printed... Having not the time to do source digging, I am of course making > assumptions on how the ac program was written... > > -MIke I suspect that you'll find this is a rounding issue. I don't recall exactly, but there are some 128 ticks per second timers, and these won't map to an exact 0.01. You're probably seeing the result of all calculations being done in 1/128ths of a second and being converted to 1/ 100ths at display time. A rough example with unrounded numbers: 1: (raw) (rounded to 1/100) root: 0.562 -> 0.56 [the rest]: 11.242 -> 11.24 ====== total: 11.803 -> 11.80 2: root: 0.564 -> 0.56 [the rest]: 11.242 -> 11.24 ====== total: 11.806 -> 11.81 3: root: 0.566 -> 0.57 [the rest]: 11.242 -> 11.24 ====== total: 11.808 -> 11.81 The raw numbers I've used would not be real 1/128 conversions, but it should give the idea. Cheers, -Peter -- Peter Wemm Netplex Consulting To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message