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

Re: `time` doesn't say seconds



> 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