* `time` doesn't say seconds
@ 2023-11-10 13:24 Ram Rachum
2023-11-10 17:26 ` Bart Schaefer
0 siblings, 1 reply; 9+ messages in thread
From: Ram Rachum @ 2023-11-10 13:24 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 349 bytes --]
Observe this call to `time`:
```
(jax_env) ➜ purejaxrl git:(main) ✗ time python foo.py
python foo.py 11.41s user 0.90s system 109% cpu 11.230 total
```
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.
Thanks,
Ram.
[-- Attachment #2: Type: text/html, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: `time` doesn't say seconds
2023-11-10 13:24 `time` doesn't say seconds Ram Rachum
@ 2023-11-10 17:26 ` Bart Schaefer
2023-11-10 17:28 ` Ram Rachum
2023-11-21 9:25 ` Peter Stephenson
0 siblings, 2 replies; 9+ messages in thread
From: Bart Schaefer @ 2023-11-10 17:26 UTC (permalink / raw)
To: Ram Rachum; +Cc: zsh-workers
On Fri, Nov 10, 2023 at 5:25 AM Ram Rachum <ram@rachum.com> 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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: `time` doesn't say seconds
2023-11-10 17:26 ` Bart Schaefer
@ 2023-11-10 17:28 ` Ram Rachum
2023-11-10 17:31 ` Bart Schaefer
2023-11-21 9:25 ` Peter Stephenson
1 sibling, 1 reply; 9+ messages in thread
From: Ram Rachum @ 2023-11-10 17:28 UTC (permalink / raw)
To: Bart Schaefer, zsh-workers
[-- Attachment #1: Type: text/plain, Size: 645 bytes --]
On Fri, Nov 10, 2023, 19:26 Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Fri, Nov 10, 2023 at 5:25 AM Ram Rachum <ram@rachum.com> 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.
>
Thanks Bart. Given this explanation, what do you think should be done here,
if anything at all?
>
[-- Attachment #2: Type: text/html, Size: 1283 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: `time` doesn't say seconds
2023-11-10 17:28 ` Ram Rachum
@ 2023-11-10 17:31 ` Bart Schaefer
0 siblings, 0 replies; 9+ messages in thread
From: Bart Schaefer @ 2023-11-10 17:31 UTC (permalink / raw)
To: Ram Rachum; +Cc: zsh-workers
On Fri, Nov 10, 2023 at 9:28 AM Ram Rachum <ram@rachum.com> wrote:
>
> Thanks Bart. Given this explanation, what do you think should be done here, if anything at all
I think you should assign TIMEFMT in your .z* files somewhere. The
default is documented.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: `time` doesn't say seconds
2023-11-10 17:26 ` Bart Schaefer
2023-11-10 17:28 ` Ram Rachum
@ 2023-11-21 9:25 ` Peter Stephenson
2023-11-22 3:36 ` Bart Schaefer
1 sibling, 1 reply; 9+ messages in thread
From: Peter Stephenson @ 2023-11-21 9:25 UTC (permalink / raw)
To: Ram Rachum, zsh-workers
[-- Attachment #1: Type: text/plain, Size: 1338 bytes --]
> On 10/11/2023 17:26 GMT Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Fri, Nov 10, 2023 at 5:25 AM Ram Rachum <ram@rachum.com> 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
[-- Attachment #2: Type: text/html, Size: 1618 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: `time` doesn't say seconds
2023-11-21 9:25 ` Peter Stephenson
@ 2023-11-22 3:36 ` Bart Schaefer
2023-11-22 11:15 ` Peter Stephenson
2023-11-22 20:23 ` Mark J. Reed
0 siblings, 2 replies; 9+ messages in thread
From: Bart Schaefer @ 2023-11-22 3:36 UTC (permalink / raw)
To: Peter Stephenson; +Cc: Ram Rachum, zsh-workers
On Tue, Nov 21, 2023 at 1:25 AM Peter Stephenson
<p.w.stephenson@ntlworld.com> 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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: `time` doesn't say seconds
2023-11-22 3:36 ` Bart Schaefer
@ 2023-11-22 11:15 ` Peter Stephenson
2023-11-22 20:23 ` Mark J. Reed
1 sibling, 0 replies; 9+ messages in thread
From: Peter Stephenson @ 2023-11-22 11:15 UTC (permalink / raw)
To: zsh-workers
> On 22/11/2023 03:36 GMT Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Tue, Nov 21, 2023 at 1:25 AM Peter Stephenson
> <p.w.stephenson@ntlworld.com> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: `time` doesn't say seconds
2023-11-22 3:36 ` Bart Schaefer
2023-11-22 11:15 ` Peter Stephenson
@ 2023-11-22 20:23 ` Mark J. Reed
2023-11-22 22:40 ` Bart Schaefer
1 sibling, 1 reply; 9+ messages in thread
From: Mark J. Reed @ 2023-11-22 20:23 UTC (permalink / raw)
To: Bart Schaefer; +Cc: Peter Stephenson, Ram Rachum, zsh-workers
[-- Attachment #1: Type: text/plain, Size: 768 bytes --]
Sorry if I'm missing some vital context (I here am new), but if the goal is
to include the "s" units in the default output of time, that's just a
matter of changing `%*E` to `%E` in the default value of TIMEFMT, right?
On Tue, Nov 21, 2023 at 10:36 PM Bart Schaefer <schaefer@brasslantern.com>
wrote:
> On Tue, Nov 21, 2023 at 1:25 AM Peter Stephenson
> <p.w.stephenson@ntlworld.com> 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.
>
>
--
Mark J. Reed <markjreed@gmail.com>
[-- Attachment #2: Type: text/html, Size: 1367 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: `time` doesn't say seconds
2023-11-22 20:23 ` Mark J. Reed
@ 2023-11-22 22:40 ` Bart Schaefer
0 siblings, 0 replies; 9+ messages in thread
From: Bart Schaefer @ 2023-11-22 22:40 UTC (permalink / raw)
To: Mark J. Reed; +Cc: Ram Rachum, zsh-workers
On Wed, Nov 22, 2023 at 12:23 PM Mark J. Reed <markjreed@gmail.com> wrote:
>
> Sorry if I'm missing some vital context (I here am new), but if the goal is to include the "s" units in the default output of time, that's just a matter of changing `%*E` to `%E` in the default value of TIMEFMT, right?
%E is always in seconds, so something that ran for an hour-ish would
say something like 3612.03s instead of e.g. 01:00:12.0297 for %*E
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-11-22 22:41 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-10 13:24 `time` doesn't say seconds Ram Rachum
2023-11-10 17:26 ` Bart Schaefer
2023-11-10 17:28 ` Ram Rachum
2023-11-10 17:31 ` Bart Schaefer
2023-11-21 9:25 ` Peter Stephenson
2023-11-22 3:36 ` Bart Schaefer
2023-11-22 11:15 ` Peter Stephenson
2023-11-22 20:23 ` Mark J. Reed
2023-11-22 22:40 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).