From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25935 invoked from network); 6 Oct 2004 11:49:28 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 6 Oct 2004 11:49:28 -0000 Received: (qmail 72767 invoked from network); 6 Oct 2004 11:49:20 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 6 Oct 2004 11:49:20 -0000 Received: (qmail 15612 invoked by alias); 6 Oct 2004 11:49:18 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20460 Received: (qmail 15592 invoked from network); 6 Oct 2004 11:49:16 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 6 Oct 2004 11:49:16 -0000 Received: (qmail 72108 invoked from network); 6 Oct 2004 11:48:19 -0000 Received: from moutng.kundenserver.de (212.227.126.177) by a.mx.sunsite.dk with SMTP; 6 Oct 2004 11:48:17 -0000 Received: from [212.227.126.205] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1CFAHJ-000887-00 for zsh-workers@sunsite.dk; Wed, 06 Oct 2004 13:48:17 +0200 Received: from [217.233.96.39] (helo=buddha.localdomain.de) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1CFAHI-0007Tk-00 for zsh-workers@sunsite.dk; Wed, 06 Oct 2004 13:48:17 +0200 Date: Wed, 6 Oct 2004 13:48:18 +0200 From: "Matthias B." Cc: zsh-workers@sunsite.dk Subject: Re: bug with for and time Message-Id: <20041006134818.089f5218@buddha.localdomain.de> In-Reply-To: <20041005181820.GC30419@dan.emsphone.com> References: <41616CDC.8020701@codesourcery.com> <200410041610.i94GAl92005952@news01.csr.com> <20041005113848.6f3715bd@buddha.localdomain.de> <20041005181820.GC30419@dan.emsphone.com> X-Mailer: Sylpheed version 0.9.8claws (GTK+ 1.2.10; i586-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:95d11223a40b7ac6df081cef1fe1fef2 X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: * X-Spam-Status: No, hits=1.6 required=6.0 tests=RCVD_IN_NJABL,RCVD_IN_SORBS autolearn=no version=2.63 X-Spam-Hits: 1.6 On Tue, 5 Oct 2004 13:18:20 -0500 Dan Nelson wrote: > In the last episode (Oct 05), Matthias B. said: > > On Mon, 04 Oct 2004 17:10:47 +0100 Peter Stephenson > > wrote: > > > Nathan Sidwell wrote: > > > > Zsh 4.0.4 appears to lose the time command in the following, > > > > > > > > nathan@garibaldi:363>for i in 1 2 ; time echo > > > > > > > > but, place the command in a subshell, and it works. > > > > > > Yes, that's always been an annoying limitation: "time" works by > > > gettings system information about subprocesses, and there isn't one > > > in this case. > > > > Then how does bash do it? bash can time builtins just fine. > > It probably calls getrusage(RUSAGE_SELF) before and after whatever > you're timing, then prints the deltas. Then maybe zsh should do that, too. Right now, zsh's time function doesn't work very well. Look at this: /home/msb> TIMEFMT=$'real\t%*Es\nuser\t%*Us\nsys \t%*Ss\ncpu \t%P' /home/msb> time /bin/echo foo foo real 0.000s user 0.000s sys 0.010s cpu 8695% /home/msb> time /bin/echo foo foo real 0.006s user 0.000s sys 0.000s cpu 0% /home/msb> time /bin/echo foo foo real 0.000s user 0.010s sys 0.000s cpu 8928% The numbers don't add up properly. I've never seen something like this with bash. MSB -- Happiness through ignorance!