branch: elpa/el-job
commit d045f9a390d0f8e26f22ba39339a67c00d1f35b6
Author: Martin Edström <[email protected]>
Commit: Martin Edström <[email protected]>
Switch most uses of time-convert to current-time
---
el-job-child.el | 15 +++++----------
el-job.el | 8 ++++----
2 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/el-job-child.el b/el-job-child.el
index 58543040e4..c3c5611e00 100644
--- a/el-job-child.el
+++ b/el-job-child.el
@@ -21,12 +21,6 @@
;;; Code:
-;; We use `time-convert' instead of `current-time' because
-;; 1. (TICKS . HZ) is fewer cons cells than (HIGH LOW USEC PSEC)
-;; 2. (TICKS . HZ) will be future default
-;; 3. If we used `current-time', we may have to inject `current-time-list'
-;; to be sure about behavior
-
(defun el-job-child--zip (metalist1 metalist2)
"Destructively zip two alists into one.
Like the Dash expression \(-zip-with #\\='nconc list1 list2).
@@ -71,21 +65,22 @@ add that information to the final return value."
(while-let ((input (read-minibuffer "")))
(when (eq input 'die)
(throw 'die nil))
- (let (item start output meta results)
+ (let ((current-time-list nil) ;; Fewer cons cells
+ item start output meta results)
(if input
(while input
(setq item (pop input))
- (setq start (time-convert nil t))
+ (setq start (current-time))
(setq output (funcall func item))
(push (time-since start) meta)
- ;; May affect the durations erratically, so do this step after.
+ ;; May affect the durations erratically, so do this step now
after benchmarks done.
(setq results (el-job-child--zip output results)))
(funcall func))
;; Ensure durations are in same order that ITEMS came in, letting us
;; associate which with which just by index.
(setq meta (nreverse meta))
;; Timestamp the finish-time. Will be the very `car' of the metadata.
- (push (time-convert nil t) meta)
+ (push (current-time) meta)
(let ((print-length nil)
(print-level nil)
;; Even though we had set :coding 'utf-8-emacs-unix in the
diff --git a/el-job.el b/el-job.el
index 5a6ecf03f7..3374f8103c 100644
--- a/el-job.el
+++ b/el-job.el
@@ -354,7 +354,7 @@ with one character of your choosing, such as a dot."
(ready nil :documentation "Processes ready for input. Becomes nil
permanently if METHOD is `reap'.")
(busy nil :documentation "Processes that have not yet returned output.")
stderr
- (timestamps (list :accept-launch-request (time-convert nil t)))
+ (timestamps (list :accept-launch-request (current-time)))
(poll-timer (timer-create))
(timeout (timer-create))
finish-times
@@ -633,7 +633,7 @@ should trigger `el-job--receive'."
(when (eq .method 'reap)
(process-send-string proc "die\n"))))))
(setf .queue nil)
- (plist-put .timestamps :launched (time-convert nil t))
+ (plist-put .timestamps :launched (current-time))
(setf .timeout (run-with-timer 30 nil #'el-job--timeout .id))
(when (eq .method 'poll)
(cancel-timer .poll-timer)
@@ -671,7 +671,7 @@ or check what is causing FUNCALL to never return.
Processes killed: %S" (truncate (* 2 el-job--global-timeout)) procs)
(mapc #'el-job--kill-quietly procs))
(setq delay (* delay 1.5))
- (timer-set-time timer (time-add delay (time-convert nil t)))
+ (timer-set-time timer (time-add delay (current-time)))
(timer-set-function timer #'el-job--poll (list procs timer delay))
(timer-activate timer))))
@@ -738,7 +738,7 @@ If nil, infer it from the buffer, if process is still
alive."
(car (last (sort .finish-times #'time-less-p))))
;; TODO: Rename this timestamp, I feel it's not intuitive.
;; Maybe :wrapup-begin?
- (plist-put .timestamps :got-all-results (time-convert nil t))
+ (plist-put .timestamps :got-all-results (current-time))
;; Cleanup
(cancel-timer .timeout)
(when .anonymous