Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: `time` doesn't say seconds
- X-seq: zsh-workers 52321
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: `time` doesn't say seconds
- Date: Wed, 22 Nov 2023 11:15:13 +0000 (GMT)
- Archived-at: <https://zsh.org/workers/52321>
- Importance: Normal
- In-reply-to: <CAH+w=7bNoi8WwN8X8MzApce99UkOhATSRmTfxkmnHh+3APh6AA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CANXboVbrpq8=YTxzvGCiLoPTVyPqFe3OBe0unRKdV1+H8x0nqw@mail.gmail.com> <CAH+w=7YvLy1Tz7C2Dns8Zk2dwjZb-co4QBnvnMBhQvCjNrJmMw@mail.gmail.com> <9658AE7C-58D0-43C7-89E2-F03090EECB06@ntlworld.com> <CAH+w=7bNoi8WwN8X8MzApce99UkOhATSRmTfxkmnHh+3APh6AA@mail.gmail.com>
> On 22/11/2023 03:36 GMT Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Tue, Nov 21, 2023 at 1:25 AM Peter Stephenson
> <p.w.stephenson@xxxxxxxxxxxx> wrote:
> >
> > I don't know if anyone is likely to be automatically matching the
> > current format? Given the variability of this element presumably not.
>
> The doc should be updated, though. It specifies the default without
> the "s". Your patch also alters the definition of %*E in the value of
> TIMEFMT.
This is the only place I can see with late level of detail.
pws
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -1721,7 +1721,8 @@ endsitem()
A star may be inserted between the percent sign and flags printing time
(e.g., `tt(%*E)'); this causes the time to be printed in
`var(hh)tt(:)var(mm)tt(:)var(ss)tt(.)var(ttt)'
-format (hours and minutes are only printed if they are not zero).
+format. Hours and minutes are only printed if they are not zero;
+an `s' is appended if they are both zero.
Alternatively, `tt(m)' or `tt(u)' may be used (e.g., `tt(%mE)') to produce
time output in milliseconds or microseconds, respectively.
)
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