Date: Sat, 28 Mar 1998 23:21:34 +0800 From: Peter Wemm <peter@netplex.com.au> To: Michael Richards <miker@scifair.acadiau.ca> Cc: freebsd-questions@FreeBSD.ORG, freebsd-bugs@FreeBSD.ORG Subject: Re: Login accounting design Message-ID: <199803281521.XAA11722@spinner.netplex.com.au> In-Reply-To: Your message of "Fri, 27 Mar 1998 20:58:06 -0400." <Pine.BSF.3.96.980327205332.28156A-100000@scifair.acadiau.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <peter@netplex.com.au> Netplex Consulting To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199803281521.XAA11722>