emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/hyperdrive 34e27bca27 10/19: Show elapsed time


From: ELPA Syncer
Subject: [nongnu] elpa/hyperdrive 34e27bca27 10/19: Show elapsed time
Date: Thu, 1 Aug 2024 01:00:11 -0400 (EDT)

branch: elpa/hyperdrive
commit 34e27bca2742f41b8192f1d9ba98fd032b2ff539
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>

    Show elapsed time
---
 hyperdrive-download-monitor.el | 10 +++++++---
 hyperdrive.el                  |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/hyperdrive-download-monitor.el b/hyperdrive-download-monitor.el
index 05abe03473..c0957cb6e5 100644
--- a/hyperdrive-download-monitor.el
+++ b/hyperdrive-download-monitor.el
@@ -47,6 +47,7 @@ UPDATE-INTERVAL seconds."
       (setf (map-elt h/download-monitor-etc :path) path
             (map-elt h/download-monitor-etc :total-size) total-size
             (map-elt h/download-monitor-etc :preamble) preamble
+            (map-elt h/download-monitor-etc :started-at) (current-time)
             (map-elt h/download-monitor-etc :timer)
             (run-at-time nil update-interval #'h//download-monitor-update 
buffer)))
     buffer))
@@ -54,17 +55,20 @@ UPDATE-INTERVAL seconds."
 (defun h//download-monitor-update (buffer)
   "Update download monitor in BUFFER."
   (with-current-buffer buffer
-    (pcase-let* (((map :preamble :path :total-size) h/download-monitor-etc)
+    (pcase-let* (((map :preamble :path :total-size :started-at)
+                  h/download-monitor-etc)
                  (attributes (and (file-exists-p path)
                                   (file-attributes path)))
                  (current-size (or (and attributes
                                         (file-attribute-size attributes))
-                                   0)))
+                                   0))
+                 (elapsed (float-time (time-subtract (current-time) 
started-at))))
       ;; TODO: Consider using `format-spec'.
       (erase-buffer)
       (insert preamble
               "Downloaded: " (file-size-human-readable current-size nil " ")
-              " / " (file-size-human-readable total-size) "\n"))))
+              " / " (file-size-human-readable total-size) "\n"
+              "Elapsed: " (format-seconds "%hh%mm%ss%z" elapsed)))))
 
 (defun h//download-monitor-close (buffer)
   "Close download monitor BUFFER."
diff --git a/hyperdrive.el b/hyperdrive.el
index 23265965c6..68b94c3e84 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -1452,7 +1452,7 @@ If FORCEP, don't prompt for confirmation before 
downloading."
            (let* ((temp-file (make-temp-name
                               (expand-file-name "hyperdrive-gateway-"
                                                 temporary-file-directory)))
-                  (preamble (format "Downloading gateway from:\n\nURL: 
%s\nTo:\n"
+                  (preamble (format "Downloading gateway from:\n\nURL: %s\nTo: 
%s\n"
                                     url destination))
                   (monitor-buffer (h//download-monitor
                                    :preamble preamble



reply via email to

[Prev in Thread] Current Thread [Next in Thread]