all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattias.engdegard@gmail.com>
To: eller.helmut@gmail.com
Cc: 65251@debbugs.gnu.org
Subject: bug#65251: 30.0.50; Duration in compilation buffer
Date: Wed, 16 Aug 2023 21:15:45 +0200	[thread overview]
Message-ID: <C70620A4-099F-454C-A0FA-6BF7FADD567A@gmail.com> (raw)
In-Reply-To: <m2edk8azac.fsf@gmail.com>

> In the *compilation* buffer, we see timestamps when the compilation
> started and finished.  It would be nice to also see how long the
> compilation command took.

Not a bad idea.
 
> +;; The time when the compilation started.
> +(defvar compilation--start-time nil)

What about using defvar-local? Then...

> +        (setq-local compilation--start-time (current-time))

can use plain setq. And if you use (float-time) here, then... 

> +     (let* ((secs (float-time (time-since compilation--start-time))))

...this becomes a simple subtraction: (- (float-time) compilation--start-time)

> +       (cond ((< secs 1) (format "%.0fms" (* secs 1000)))
> +	     ((< secs 10) (format "%.2fs" secs))
> +	     ((< secs 60) (format "%.1fs" secs))
> +	     (t (format-seconds "%hh%mm%z%ss" secs)))))

First of all, proper style is to separate the number and unit by a space.
The 'ms' case isn't very important -- 745 ms is no more readable than 0.745 s, probably less so.
The last case is also less than readable. Something like 3:45:58 would be better.

The reader would also like to know what this new time indication means. What about

   ..., duration 34.5 s

or

   ..., 34.5 s elapsed

?






  reply	other threads:[~2023-08-16 19:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-12 18:30 bug#65251: 30.0.50; Duration in compilation buffer Helmut Eller
2023-08-16 19:15 ` Mattias Engdegård [this message]
2023-08-16 22:36   ` Helmut Eller
2023-08-17  5:33     ` Eli Zaretskii
2023-08-17  5:55       ` Helmut Eller
2023-08-17  6:05         ` Eli Zaretskii
2023-08-17 18:48           ` Helmut Eller
2023-08-18 12:06             ` Mattias Engdegård
2023-08-18 20:55               ` Helmut Eller
2023-08-19  5:54                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C70620A4-099F-454C-A0FA-6BF7FADD567A@gmail.com \
    --to=mattias.engdegard@gmail.com \
    --cc=65251@debbugs.gnu.org \
    --cc=eller.helmut@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.