summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/benchmark.el2
-rw-r--r--lisp/emacs-lisp/ert.el4
-rw-r--r--lisp/emacs-lisp/timer-list.el16
-rw-r--r--lisp/emacs-lisp/timer.el8
4 files changed, 14 insertions, 16 deletions
diff --git a/lisp/emacs-lisp/benchmark.el b/lisp/emacs-lisp/benchmark.el
index f7384e19a1c..5b5cda36156 100644
--- a/lisp/emacs-lisp/benchmark.el
+++ b/lisp/emacs-lisp/benchmark.el
@@ -38,7 +38,7 @@
`(let (,t1)
(setq ,t1 (current-time))
,@forms
- (float-time (time-subtract nil ,t1)))))
+ (float-time (time-since ,t1)))))
;;;###autoload
(defmacro benchmark-run (&optional repetitions &rest forms)
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index d6bd2c59679..20d013b0797 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -1822,13 +1822,13 @@ determines how frequently the progress display is updated.")
(force-mode-line-update)
(redisplay t)
(setf (ert--stats-next-redisplay stats)
- (+ (float-time) ert-test-run-redisplay-interval-secs)))
+ (float-time (time-add nil ert-test-run-redisplay-interval-secs))))
(defun ert--results-update-stats-display-maybe (ewoc stats)
"Call `ert--results-update-stats-display' if not called recently.
EWOC and STATS are arguments for `ert--results-update-stats-display'."
- (when (>= (float-time) (ert--stats-next-redisplay stats))
+ (unless (time-less-p nil (ert--stats-next-redisplay stats))
(ert--results-update-stats-display ewoc stats)))
(defun ert--tests-running-mode-line-indicator ()
diff --git a/lisp/emacs-lisp/timer-list.el b/lisp/emacs-lisp/timer-list.el
index c9b2fae7d91..81e2f91c0e5 100644
--- a/lisp/emacs-lisp/timer-list.el
+++ b/lisp/emacs-lisp/timer-list.el
@@ -37,16 +37,14 @@
;; Idle.
(if (aref timer 7) "*" " ")
;; Next time.
- (let ((time (float-time (list (aref timer 1)
- (aref timer 2)
- (aref timer 3)))))
+ (let ((time (list (aref timer 1)
+ (aref timer 2)
+ (aref timer 3))))
(format "%.2f"
- (if (aref timer 7)
- time
- (- (float-time (list (aref timer 1)
- (aref timer 2)
- (aref timer 3)))
- (float-time)))))
+ (float-time
+ (if (aref timer 7)
+ time
+ (time-subtract time nil)))))
;; Repeat.
(let ((repeat (aref timer 4)))
(cond
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el
index 51d7e6f99e2..f706d9bc626 100644
--- a/lisp/emacs-lisp/timer.el
+++ b/lisp/emacs-lisp/timer.el
@@ -74,7 +74,7 @@
(defun timer-set-time (timer time &optional delta)
"Set the trigger time of TIMER to TIME.
-TIME must be in the internal format returned by, e.g., `current-time'.
+TIME must be a Lisp time value.
If optional third argument DELTA is a positive number, make the timer
fire repeatedly that many seconds apart."
(setf (timer--time timer) time)
@@ -249,8 +249,8 @@ how many will really happen."
(defun timer-until (timer time)
"Calculate number of seconds from when TIMER will run, until TIME.
TIMER is a timer, and stands for the time when its next repeat is scheduled.
-TIME is a time-list."
- (- (float-time time) (float-time (timer--time timer))))
+TIME is a Lisp time value."
+ (float-time (time-subtract time (timer--time timer))))
(defun timer-event-handler (timer)
"Call the handler for the timer TIMER.
@@ -281,7 +281,7 @@ This function is called, by name, directly by the C code."
;; perhaps because Emacs was suspended for a long time,
;; limit how many times things get repeated.
(if (and (numberp timer-max-repeats)
- (< 0 (timer-until timer nil)))
+ (time-less-p nil (timer--time timer)))
(let ((repeats (/ (timer-until timer nil)
(timer--repeat-delay timer))))
(if (> repeats timer-max-repeats)