[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#65251: 30.0.50; Duration in compilation buffer
From: |
Mattias Engdegård |
Subject: |
bug#65251: 30.0.50; Duration in compilation buffer |
Date: |
Wed, 16 Aug 2023 21:15:45 +0200 |
> 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
?
- bug#65251: 30.0.50; Duration in compilation buffer, Helmut Eller, 2023/08/12
- bug#65251: 30.0.50; Duration in compilation buffer,
Mattias Engdegård <=
- bug#65251: 30.0.50; Duration in compilation buffer, Helmut Eller, 2023/08/16
- bug#65251: 30.0.50; Duration in compilation buffer, Eli Zaretskii, 2023/08/17
- bug#65251: 30.0.50; Duration in compilation buffer, Helmut Eller, 2023/08/17
- bug#65251: 30.0.50; Duration in compilation buffer, Eli Zaretskii, 2023/08/17
- bug#65251: 30.0.50; Duration in compilation buffer, Helmut Eller, 2023/08/17
- bug#65251: 30.0.50; Duration in compilation buffer, Mattias Engdegård, 2023/08/18
- bug#65251: 30.0.50; Duration in compilation buffer, Helmut Eller, 2023/08/18
- bug#65251: 30.0.50; Duration in compilation buffer, Eli Zaretskii, 2023/08/19