Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: `time` doesn't say seconds
- X-seq: zsh-workers 52317
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: Ram Rachum <ram@xxxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: `time` doesn't say seconds
- Date: Tue, 21 Nov 2023 09:25:11 +0000
- Archived-at: <https://zsh.org/workers/52317>
- In-reply-to: <CAH+w=7YvLy1Tz7C2Dns8Zk2dwjZb-co4QBnvnMBhQvCjNrJmMw@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CANXboVbrpq8=YTxzvGCiLoPTVyPqFe3OBe0unRKdV1+H8x0nqw@mail.gmail.com> <CAH+w=7YvLy1Tz7C2Dns8Zk2dwjZb-co4QBnvnMBhQvCjNrJmMw@mail.gmail.com>
> On 10/11/2023 17:26 GMT Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Fri, Nov 10, 2023 at 5:25 AM Ram Rachum <ram@xxxxxxxxxx> wrote:
> >
> > If I understand correctly, the 11.230 number is 11.230 seconds, but
> > for some reason it doesn't have "s" after it like 11.41s and
> > 0.90s. I think that it should.
>
> TIMEFMT='%J %U user %S system %P cpu %E total'
>
> The default format instead uses %*E which drops the trailing "s" and
> uses HH:MM:SS.TTT instead, but the HH and MM are also dropped when
> zero.
I meant to follow up to this one.
It could be made more consistent by putting back the s in that last
case, though. Without the colon indicating the meaning of the numbers
(though MM:SS and HH:MM are also a bit ambiguous) this probably makes
more sense.
I don't know if anyone is likely to be automatically matching the
current format? Given the variability of this element presumably not.
diff --git a/Src/jobs.c b/Src/jobs.c
index a3b9f667a..bb9246837 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -730,7 +730,7 @@ printhhmmss(double secs)
else if (mins)
fprintf(stderr, "%d:%05.2f", mins, secs);
else
- fprintf(stderr, "%.3f", secs);
+ fprintf(stderr, "%.3fs", secs);
}
static void
Messages sorted by:
Reverse Date,
Date,
Thread,
Author