summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-12-05 18:25:46 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2021-12-05 23:24:08 -0800
commit524c42fa0eb9e4bf02d39e4d04353a354a84cebc (patch)
tree671472c27628d7b25c8e29b894c140c3f9c9ab73 /test
parentaf6061894598efdcb1aeebbac2283d6e1d085820 (diff)
downloademacs-524c42fa0eb9e4bf02d39e4d04353a354a84cebc.tar.gz
Prefer nil to (current-time) when either will do
* lisp/emacs-lisp/timer.el (timer-event-handler, run-at-time): * lisp/gnus/gnus-score.el (gnus-score-date): * lisp/gnus/gnus-search.el (gnus-search-query-parse-date) (gnus-search-imap-handle-date): * lisp/gnus/gnus-sum.el (gnus-user-date) (gnus-summary-create-article): * lisp/image-dired.el (image-dired-create-thumb-1): * lisp/image/gravatar.el (gravatar-retrieve) (gravatar--prune-cache): * lisp/net/dbus.el (dbus-monitor-handler): * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-set-file-times): * lisp/net/tramp-sh.el (tramp-sh-handle-set-file-times): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-times): * test/lisp/autorevert-tests.el (auto-revert--wait-for-revert) (auto-revert-tests--write-file, auto-revert-test--wait-for): * test/lisp/net/tramp-tests.el (tramp--test-print-duration): Prefer nil to (current-time) when either will do, as this avoids some consing. Similarly, prefer omitting (current-time) arg when this is equivalent.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/autorevert-tests.el6
-rw-r--r--test/lisp/net/tramp-tests.el2
2 files changed, 4 insertions, 4 deletions
diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el
index b9d45324cb7..b31f0a9afc4 100644
--- a/test/lisp/autorevert-tests.el
+++ b/test/lisp/autorevert-tests.el
@@ -127,7 +127,7 @@ This expects `auto-revert--messages' to be bound by
`ert-with-message-capture' before calling."
;; Remote files do not cooperate well with timers. So we count ourselves.
(let ((ct (current-time)))
- (while (and (< (float-time (time-subtract (current-time) ct))
+ (while (and (< (float-time (time-subtract nil ct))
(auto-revert--timeout))
(null (string-match
(format-message
@@ -167,7 +167,7 @@ This expects `auto-revert--messages' to be bound by
(defun auto-revert-tests--write-file (text file time-delta &optional append)
(write-region text nil file append 'no-message)
- (set-file-times file (time-subtract (current-time) time-delta)))
+ (set-file-times file (time-subtract nil time-delta)))
(ert-deftest auto-revert-test00-auto-revert-mode ()
"Check autorevert for a file."
@@ -453,7 +453,7 @@ This expects `auto-revert--messages' to be bound by
(defun auto-revert-test--wait-for (pred max-wait)
"Wait until PRED is true, or MAX-WAIT seconds elapsed."
(let ((ct (current-time)))
- (while (and (< (float-time (time-subtract (current-time) ct)) max-wait)
+ (while (and (< (float-time (time-subtract nil ct)) max-wait)
(not (funcall pred)))
(read-event nil nil 0.1))))
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 47fa18eb806..c047f666dae 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -241,7 +241,7 @@ is greater than 10.
(progn ,@body)
(tramp--test-message
"%s %f sec"
- ,message (float-time (time-subtract (current-time) start))))))
+ ,message (float-time (time-subtract nil start))))))
;; `always' is introduced with Emacs 28.1.
(defalias 'tramp--test-always