Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: `time` doesn't say seconds



> 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