From: Paul Eggert Date: Sat, 21 Oct 2017 02:40:09 +0000 (-0700) Subject: Prefer nil to (current-time) when either works X-Git-Tag: emacs-27.0.90~6232 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c75f505dea6a560b825384cf3d277690f86840bf;p=emacs.git Prefer nil to (current-time) when either works * doc/misc/gnus.texi (Category Syntax): * lisp/allout-widgets.el (allout-widgets-post-command-business): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/cedet/pulse.el (pulse-momentary-highlight-overlay) (pulse-tick): * lisp/cedet/semantic.el (bovinate): * lisp/cedet/semantic/analyze.el: (semantic-analyze-current-symbol-default, semantic-adebug-analyze): * lisp/cedet/semantic/analyze/refs.el (semantic-analyze-current-tag): * lisp/cedet/semantic/lex.el (semantic-lex-test): * lisp/cedet/semantic/symref/filter.el: (semantic-symref-test-count-hits-in-tag): * lisp/cedet/srecode/dictionary.el (srecode-adebug-dictionary): * lisp/cedet/srecode/map.el (srecode-adebug-maps): * lisp/desktop.el (desktop-create-buffer): * lisp/emacs-lisp/benchmark.el (benchmark-elapse): * lisp/emacs-lisp/elp.el (elp--make-wrapper): * lisp/epa.el (epa--show-key): * lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p): * lisp/gnus/gnus-agent.el (gnus-agent-fetch-articles) (gnus-agent-expire-group-1, gnus-agent-store-article): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-cloud.el (gnus-cloud-update-newsrc-data) (gnus-cloud-collect-full-newsrc): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/gnus-html.el (gnus-html-cache-expired): * lisp/gnus/gnus-score.el (gnus-score-load-file) (gnus-decay-scores): * lisp/gnus/nndiary.el (nndiary-expired-article-p): * lisp/gnus/nnmail.el (nnmail-expired-article-p): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/gnus/score-mode.el (gnus-score-edit-insert-date): * lisp/image/gravatar.el (gravatar-cache-expired): * lisp/net/newst-backend.el (newsticker--image-get) (newsticker--cache-mark-expired): * lisp/nxml/rng-maint.el (rng-time-function): * lisp/org/org-agenda.el (org-agenda-to-appt): * lisp/org/org-clock.el (org-clock-resolve-clock) (org-clock-resolve, org-resolve-clocks-if-idle): * lisp/org/org-colview.el (org-columns-edit-value, org-columns) (org-columns-compute-all, org-agenda-columns): * lisp/org/org-element.el (org-element--cache-interrupt-p) (org-element--cache-sync): * lisp/org/org-habit.el (org-habit-get-faces) (org-habit-insert-consistency-graphs): * lisp/org/org-indent.el (org-indent-add-properties): * lisp/org/org-timer.el (org-timer-start) (org-timer-pause-or-continue, org-timer-seconds) (org-timer-show-remaining-time, org-timer-set-timer): * lisp/org/org.el (org-babel-load-file, org-current-time) (org-today, org-auto-repeat-maybe, org-read-date-analyze) (org-small-year-to-year, org-goto-calendar): * lisp/org/ox.el (org-export-insert-default-template): * lisp/time.el (emacs-uptime): * lisp/type-break.el (type-break-mode, type-break) (type-break-time-warning-schedule, type-break-check): * lisp/url/url-cache.el (url-cache-expired): * lisp/url/url.el (url-retrieve-synchronously): * test/lisp/char-fold-tests.el (char-fold--speed-test): * test/manual/cedet/semantic-ia-utest.el: (semantic-symref-test-count-hits-in-tag): * test/manual/cedet/semantic-tests.el (semantic-idle-pnf-test) (semantic-lex-test-full-depth): Use nil instead of (current-time) where either will do, as nil is a bit more efficient and should have less timing error. --- diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 15c6230ad0b..33078d711a2 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -18492,7 +18492,7 @@ something along the lines of the following: (defun my-article-old-p () "Say whether an article is old." (< (time-to-days (date-to-time (mail-header-date gnus-headers))) - (- (time-to-days (current-time)) gnus-agent-expire-days))) + (- (time-to-days nil) gnus-agent-expire-days))) @end lisp with the predicate then defined as: diff --git a/lisp/allout-widgets.el b/lisp/allout-widgets.el index 4338181c340..9fa927ddcb3 100644 --- a/lisp/allout-widgets.el +++ b/lisp/allout-widgets.el @@ -768,8 +768,7 @@ Optional RECURSING is for internal use, to limit recursion." (if allout-widgets-time-decoration-activity (setq allout-widgets-last-decoration-timing - (list (allout-elapsed-time-seconds (current-time) - start-time) + (list (allout-elapsed-time-seconds nil start-time) allout-widgets-changes-record))) (setq allout-widgets-changes-record nil) diff --git a/lisp/cedet/ede/detect.el b/lisp/cedet/ede/detect.el index 6240d465982..25426dfeba6 100644 --- a/lisp/cedet/ede/detect.el +++ b/lisp/cedet/ede/detect.el @@ -195,11 +195,10 @@ Return a cons cell: "Run a quick test for autodetecting on BUFFER." (interactive) (let ((start (current-time)) - (ans (ede-detect-directory-for-project default-directory)) - (end (current-time))) + (ans (ede-detect-directory-for-project default-directory))) (if ans (message "Project found in %d sec @ %s of type %s" - (float-time (time-subtract end start)) + (float-time (time-subtract nil start)) (car ans) (eieio-object-name-string (cdr ans))) (message "No Project found.") ))) diff --git a/lisp/cedet/pulse.el b/lisp/cedet/pulse.el index 51df5e9ffe4..3554ee242b8 100644 --- a/lisp/cedet/pulse.el +++ b/lisp/cedet/pulse.el @@ -196,11 +196,11 @@ Optional argument FACE specifies the face to do the highlighting." (pulse-reset-face face) (setq pulse-momentary-timer (run-with-timer 0 pulse-delay #'pulse-tick - (time-add (current-time) + (time-add nil (* pulse-delay pulse-iterations))))))) (defun pulse-tick (stop-time) - (if (time-less-p (current-time) stop-time) + (if (time-less-p nil stop-time) (pulse-lighten-highlight) (pulse-momentary-unhighlight))) diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el index 682ac89978f..cae6e049f44 100644 --- a/lisp/cedet/semantic.el +++ b/lisp/cedet/semantic.el @@ -389,10 +389,9 @@ the output buffer." (if clear (semantic-clear-toplevel-cache)) (if (eq clear '-) (setq clear -1)) (let* ((start (current-time)) - (out (semantic-fetch-tags)) - (end (current-time))) + (out (semantic-fetch-tags))) (message "Retrieving tags took %.2f seconds." - (semantic-elapsed-time start end)) + (semantic-elapsed-time start nil)) (when (or (null clear) (not (listp clear)) (and (numberp clear) (< 0 clear))) (pop-to-buffer "*Parser Output*") diff --git a/lisp/cedet/semantic/analyze.el b/lisp/cedet/semantic/analyze.el index 517e1be8eca..b528487887a 100644 --- a/lisp/cedet/semantic/analyze.el +++ b/lisp/cedet/semantic/analyze.el @@ -440,12 +440,11 @@ to provide a large number of non-cached analysis for filtering symbols." (defun semantic-analyze-current-symbol-default (analyzehookfcn position) "Call ANALYZEHOOKFCN on the analyzed symbol at POSITION." (let* ((semantic-analyze-error-stack nil) - (LLstart (current-time)) + ;; (LLstart (current-time)) (prefixandbounds (semantic-ctxt-current-symbol-and-bounds (or position (point)))) (prefix (car prefixandbounds)) (bounds (nth 2 prefixandbounds)) (scope (semantic-calculate-scope position)) - (end nil) ) ;; Only do work if we have bounds (meaning a prefix to complete) (when bounds @@ -464,15 +463,13 @@ to provide a large number of non-cached analysis for filtering symbols." prefix scope 'prefixtypes)) (error (semantic-analyze-push-error err)))) - (setq end (current-time)) - ;;(message "Analysis took %.2f sec" (semantic-elapsed-time LLstart end)) + ;;(message "Analysis took %.2f sec" (semantic-elapsed-time LLstart nil)) ) (when prefix (prog1 (funcall analyzehookfcn (car bounds) (cdr bounds) prefix) - ;;(setq end (current-time)) - ;;(message "hookfcn took %.5f sec" (semantic-elapsed-time LLstart end)) + ;;(message "hookfcn took %.5f sec" (semantic-elapsed-time LLstart nil)) ) ))) @@ -723,12 +720,11 @@ Optional argument CTXT is the context to show." (interactive) (require 'data-debug) (let ((start (current-time)) - (ctxt (or ctxt (semantic-analyze-current-context))) - (end (current-time))) + (ctxt (or ctxt (semantic-analyze-current-context)))) (if (not ctxt) (message "No Analyzer Results") (message "Analysis took %.2f seconds." - (semantic-elapsed-time start end)) + (semantic-elapsed-time start nil)) (semantic-analyze-pulse ctxt) (if ctxt (progn diff --git a/lisp/cedet/semantic/analyze/refs.el b/lisp/cedet/semantic/analyze/refs.el index 55fcd830433..e7a4424d6ff 100644 --- a/lisp/cedet/semantic/analyze/refs.el +++ b/lisp/cedet/semantic/analyze/refs.el @@ -317,9 +317,8 @@ Only works for tags in the global namespace." (let* ((tag (semantic-current-tag)) (start (current-time)) (sac (semantic-analyze-tag-references tag)) - (end (current-time)) ) - (message "Analysis took %.2f seconds." (semantic-elapsed-time start end)) + (message "Analysis took %.2f seconds." (semantic-elapsed-time start nil)) (if sac (progn (require 'eieio-datadebug) diff --git a/lisp/cedet/semantic/lex.el b/lisp/cedet/semantic/lex.el index eec6e6762f3..835888db2ad 100644 --- a/lisp/cedet/semantic/lex.el +++ b/lisp/cedet/semantic/lex.el @@ -657,10 +657,9 @@ If universal argument ARG, then try the whole buffer." (let* ((start (current-time)) (result (semantic-lex (if arg (point-min) (point)) - (point-max))) - (end (current-time))) + (point-max)))) (message "Elapsed Time: %.2f seconds." - (semantic-elapsed-time start end)) + (semantic-elapsed-time start nil)) (pop-to-buffer "*Lexer Output*") (require 'pp) (erase-buffer) @@ -810,7 +809,7 @@ analyzer which might mistake a number for as a symbol." tmp-start (car semantic-lex-token-stream))) (setq tmp-start semantic-lex-end-point) (goto-char semantic-lex-end-point) - ;;(when (> (semantic-elapsed-time starttime (current-time)) + ;;(when (> (semantic-elapsed-time starttime nil) ;; semantic-lex-timeout) ;; (error "Timeout during lex at char %d" (point))) (semantic-throw-on-input 'lex) diff --git a/lisp/cedet/semantic/symref/filter.el b/lisp/cedet/semantic/symref/filter.el index 53be5e0defb..d5766af9b6e 100644 --- a/lisp/cedet/semantic/symref/filter.el +++ b/lisp/cedet/semantic/symref/filter.el @@ -103,7 +103,7 @@ tag that contains point, and return that." (when (called-interactively-p 'interactive) (message "Found %d occurrences of %s in %.2f seconds" Lcount (semantic-tag-name target) - (semantic-elapsed-time start (current-time)))) + (semantic-elapsed-time start nil))) Lcount))) (defun semantic-symref-rename-local-variable () diff --git a/lisp/cedet/srecode/dictionary.el b/lisp/cedet/srecode/dictionary.el index 4507581621d..6c8fd655d7b 100644 --- a/lisp/cedet/srecode/dictionary.el +++ b/lisp/cedet/srecode/dictionary.el @@ -612,10 +612,9 @@ STATE is the current compiler state." (srecode-get-mode-table modesym)) (error "No table found for mode %S" modesym))) (dict (srecode-create-dictionary (current-buffer))) - (end (current-time)) ) (message "Creating a dictionary took %.2f seconds." - (semantic-elapsed-time start end)) + (semantic-elapsed-time start nil)) (data-debug-new-buffer "*SRECODE ADEBUG*") (data-debug-insert-object-slots dict "*"))) diff --git a/lisp/cedet/srecode/map.el b/lisp/cedet/srecode/map.el index 10541f61a9e..5b5d1fdd47d 100644 --- a/lisp/cedet/srecode/map.el +++ b/lisp/cedet/srecode/map.el @@ -224,10 +224,9 @@ Optional argument RESET forces a reset of the current map." (require 'data-debug) (let ((start (current-time)) (p (srecode-get-maps t)) ;; Time the reset. - (end (current-time)) ) (message "Updating the map took %.2f seconds." - (semantic-elapsed-time start end)) + (semantic-elapsed-time start nil)) (data-debug-new-buffer "*SRECODE ADEBUG*") (data-debug-insert-stuff-list p "*"))) diff --git a/lisp/desktop.el b/lisp/desktop.el index 73228ce040b..66e2aef9798 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -1554,8 +1554,7 @@ and try to load that." (setq buffer-display-time (if buffer-display-time (time-add buffer-display-time - (time-subtract (current-time) - desktop-file-modtime)) + (time-subtract nil desktop-file-modtime)) (current-time))) (unless (< desktop-file-version 208) ; Don't misinterpret any old custom args (dolist (record compacted-vars) diff --git a/lisp/emacs-lisp/benchmark.el b/lisp/emacs-lisp/benchmark.el index 445e78b427c..02db21a7e53 100644 --- a/lisp/emacs-lisp/benchmark.el +++ b/lisp/emacs-lisp/benchmark.el @@ -34,13 +34,11 @@ (defmacro benchmark-elapse (&rest forms) "Return the time in seconds elapsed for execution of FORMS." (declare (indent 0) (debug t)) - (let ((t1 (make-symbol "t1")) - (t2 (make-symbol "t2"))) - `(let (,t1 ,t2) + (let ((t1 (make-symbol "t1"))) + `(let (,t1) (setq ,t1 (current-time)) ,@forms - (setq ,t2 (current-time)) - (float-time (time-subtract ,t2 ,t1))))) + (float-time (time-subtract nil ,t1))))) ;;;###autoload (defmacro benchmark-run (&optional repetitions &rest forms) diff --git a/lisp/emacs-lisp/elp.el b/lisp/emacs-lisp/elp.el index 2be9c9da865..905718dad68 100644 --- a/lisp/emacs-lisp/elp.el +++ b/lisp/emacs-lisp/elp.el @@ -382,14 +382,13 @@ original definition, use \\[elp-restore-function] or \\[elp-restore-all]." ;; and return the results. (setq result (apply func args)) ;; we are recording times - (let (enter-time exit-time) + (let (enter-time) ;; increment the call-counter (cl-incf (aref info 0)) (setq enter-time (current-time) - result (apply func args) - exit-time (current-time)) + result (apply func args)) ;; calculate total time in function - (cl-incf (aref info 1) (elp-elapsed-time enter-time exit-time)) + (cl-incf (aref info 1) (elp-elapsed-time enter-time nil)) )) ;; turn off recording if this is the master function (if (and elp-master diff --git a/lisp/epa.el b/lisp/epa.el index 6e908e1aa3b..aca9aaa7d22 100644 --- a/lisp/epa.el +++ b/lisp/epa.el @@ -561,7 +561,7 @@ If SECRET is non-nil, list secret keys instead of public keys." (epg-sub-key-creation-time (car pointer))) (error "????-??-??")) (if (epg-sub-key-expiration-time (car pointer)) - (format (if (time-less-p (current-time) + (format (if (time-less-p nil (epg-sub-key-expiration-time (car pointer))) "\n\tExpires: %s" diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 0e56b732d81..fdc4a647777 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -2548,9 +2548,7 @@ consumption for long-lived IRC or Emacs sessions." (maphash (lambda (nick last-PRIVMSG-time) (when - (> (float-time (time-subtract - (current-time) - last-PRIVMSG-time)) + (> (float-time (time-subtract nil last-PRIVMSG-time)) erc-lurker-threshold-time) (remhash nick hash))) hash) @@ -2617,7 +2615,7 @@ server within `erc-lurker-threshold-time'. See also (gethash server erc-lurker-state (make-hash-table))))) (or (null last-PRIVMSG-time) (> (float-time - (time-subtract (current-time) last-PRIVMSG-time)) + (time-subtract nil last-PRIVMSG-time)) erc-lurker-threshold-time)))) (defcustom erc-common-server-suffixes diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el index daf578180f2..6e7cc57a4cc 100644 --- a/lisp/gnus/gnus-agent.el +++ b/lisp/gnus/gnus-agent.el @@ -1513,7 +1513,7 @@ downloaded into the agent." (let* ((fetched-articles (list nil)) (tail-fetched-articles fetched-articles) (dir (gnus-agent-group-pathname group)) - (date (time-to-days (current-time))) + (date (time-to-days nil)) (case-fold-search t) pos crosses (file-name-coding-system nnmail-pathname-coding-system)) @@ -3089,7 +3089,7 @@ FORCE is equivalent to setting the expiration predicates to true." (nov-entries-deleted 0) (info (gnus-get-info group)) (alist gnus-agent-article-alist) - (day (- (time-to-days (current-time)) + (day (- (time-to-days nil) (gnus-agent-find-parameter group 'agent-days-until-old))) (specials (if (and alist (not force)) @@ -3824,7 +3824,7 @@ has been fetched." ;; be expired later. (gnus-agent-load-alist group) (gnus-agent-save-alist group (list article) - (time-to-days (current-time)))))) + (time-to-days nil))))) (defun gnus-agent-regenerate-group (group &optional reread) "Regenerate GROUP. diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index c130dc1b6c6..97aa878ab63 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -3628,8 +3628,7 @@ possible values." (defun article-lapsed-string (time &optional max-segments) ;; If the date is seriously mangled, the timezone functions are ;; liable to bug out, so we ignore all errors. - (let* ((now (current-time)) - (real-time (time-subtract now time)) + (let* ((real-time (time-subtract nil time)) (real-sec (and real-time (+ (* (float (car real-time)) 65536) (cadr real-time)))) diff --git a/lisp/gnus/gnus-cloud.el b/lisp/gnus/gnus-cloud.el index 5ea2d691f15..c57576cf3c7 100644 --- a/lisp/gnus/gnus-cloud.el +++ b/lisp/gnus/gnus-cloud.el @@ -219,7 +219,7 @@ easy interactive way to set this from the Server buffer." Use old data if FORCE-OLDER is not nil." (let* ((contents (plist-get elem :contents)) (date (or (plist-get elem :timestamp) "0")) - (now (gnus-cloud-timestamp (current-time))) + (now (gnus-cloud-timestamp nil)) (newer (string-lessp date now)) (group-info (gnus-get-info group))) (if (and contents @@ -486,7 +486,7 @@ Otherwise, returns the Gnus Cloud data chunks." (gnus-method-to-server (gnus-find-method-for-group (gnus-info-group info)))) - (push `(:type :newsrc-data :name ,(gnus-info-group info) :contents ,info :timestamp ,(gnus-cloud-timestamp (current-time))) + (push `(:type :newsrc-data :name ,(gnus-info-group info) :contents ,info :timestamp ,(gnus-cloud-timestamp nil)) infos))) infos)) diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 985efe6272f..1174f90e1ad 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -4560,7 +4560,7 @@ or `gnus-group-catchup-group-hook'." "Return the offset in seconds from the timestamp for GROUP to the current time, as a floating point number." (let* ((time (or (gnus-group-timestamp group) (list 0 0))) - (delta (time-subtract (current-time) time))) + (delta (time-subtract nil time))) (+ (* (nth 0 delta) 65536.0) (nth 1 delta)))) diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el index 6d529558f73..7fa36359f67 100644 --- a/lisp/gnus/gnus-html.el +++ b/lisp/gnus/gnus-html.el @@ -99,11 +99,7 @@ fit these criteria." (not (file-exists-p (url-cache-create-filename url)))) (t (let ((cache-time (url-is-cached url))) (if cache-time - (time-less-p - (time-add - cache-time - ttl) - (current-time)) + (time-less-p (time-add cache-time ttl) nil) t))))) ;;;###autoload diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el index 976ac9f7f35..bc11aa528fa 100644 --- a/lisp/gnus/gnus-score.el +++ b/lisp/gnus/gnus-score.el @@ -1238,7 +1238,7 @@ If FORMAT, also format the current score file." (or (not decay) (gnus-decay-scores alist decay))) (gnus-score-set 'touched '(t) alist) - (gnus-score-set 'decay (list (time-to-days (current-time))) alist)) + (gnus-score-set 'decay (list (time-to-days nil)) alist)) ;; We do not respect eval and files atoms from global score ;; files. (when (and files (not global)) @@ -3062,7 +3062,7 @@ If ADAPT, return the home adaptive file instead." (defun gnus-decay-scores (alist day) "Decay non-permanent scores in ALIST." - (let ((times (- (time-to-days (current-time)) day)) + (let ((times (- (time-to-days nil) day)) kill entry updated score n) (unless (zerop times) ;Done decays today already? (while (setq entry (pop alist)) diff --git a/lisp/gnus/nndiary.el b/lisp/gnus/nndiary.el index 2589fa80893..ca4dca4189d 100644 --- a/lisp/gnus/nndiary.el +++ b/lisp/gnus/nndiary.el @@ -1532,7 +1532,7 @@ all. This may very well take some time.") ;; past. A permanent schedule never expires. (and sched (setq sched (nndiary-last-occurrence sched)) - (time-less-p sched (current-time)))) + (time-less-p sched nil))) ;; else (nnheader-report 'nndiary "Could not read file %s" file) nil) diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el index db5415cf9f7..ad58d292082 100644 --- a/lisp/gnus/nnmail.el +++ b/lisp/gnus/nnmail.el @@ -1883,7 +1883,7 @@ If TIME is nil, then return the cutoff time for oldness instead." (setq days (days-to-time days)) ;; Compare the time with the current time. (if (null time) - (time-subtract (current-time) days) + (time-subtract nil days) (ignore-errors (time-less-p days (time-since time))))))))) (declare-function gnus-group-mark-article-read "gnus-group" (group article)) diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el index 272240f5a9f..708a3426af1 100644 --- a/lisp/gnus/nnmaildir.el +++ b/lisp/gnus/nnmaildir.el @@ -814,7 +814,7 @@ This variable is set by `nnmaildir-request-article'.") (when (or isnew nattr) (dolist (file (funcall ls ndir nil "\\`[^.]" 'nosort)) (setq x (concat ndir file)) - (and (time-less-p (nth 5 (file-attributes x)) (current-time)) + (and (time-less-p (nth 5 (file-attributes x)) nil) (rename-file x (concat cdir (nnmaildir--ensure-suffix file))))) (setf (nnmaildir--grp-new group) nattr)) (setq cattr (nth 5 (file-attributes cdir))) diff --git a/lisp/gnus/score-mode.el b/lisp/gnus/score-mode.el index 098ecd5dc3d..3e7428493e4 100644 --- a/lisp/gnus/score-mode.el +++ b/lisp/gnus/score-mode.el @@ -85,7 +85,7 @@ This mode is an extended emacs-lisp mode. (defun gnus-score-edit-insert-date () "Insert date in numerical format." (interactive) - (princ (time-to-days (current-time)) (current-buffer))) + (princ (time-to-days nil) (current-buffer))) (defun gnus-score-pretty-print () "Format the current score file." diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el index 6628195cfa6..6173c8527eb 100644 --- a/lisp/image/gravatar.el +++ b/lisp/image/gravatar.el @@ -77,11 +77,7 @@ (not (file-exists-p (url-cache-create-filename url)))) (t (let ((cache-time (url-is-cached url))) (if cache-time - (time-less-p - (time-add - cache-time - gravatar-cache-ttl) - (current-time)) + (time-less-p (time-add cache-time gravatar-cache-ttl) nil) t))))) (defun gravatar-get-data () diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index 5f68dea1be7..7a73d4688aa 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -1807,7 +1807,7 @@ If the file does no exist or if it is older than 24 hours download it from URL first." (let ((image-name (concat directory feed-name))) (if (and (file-exists-p image-name) - (time-less-p (current-time) + (time-less-p nil (time-add (nth 5 (file-attributes image-name)) (seconds-to-time 86400)))) (newsticker--debug-msg "%s: Getting image for %s skipped" @@ -2004,7 +2004,7 @@ older than TIME." (when (eq (newsticker--age item) old-age) (let ((exp-time (time-add (newsticker--time item) (seconds-to-time time)))) - (when (time-less-p exp-time (current-time)) + (when (time-less-p exp-time nil) (newsticker--debug-msg "Item `%s' from %s has expired on %s" (newsticker--title item) diff --git a/lisp/nxml/rng-maint.el b/lisp/nxml/rng-maint.el index 85614822be8..8d85f2ea06b 100644 --- a/lisp/nxml/rng-maint.el +++ b/lisp/nxml/rng-maint.el @@ -226,11 +226,10 @@ (defun rng-time-function (function &rest args) (let* ((start (current-time)) - (val (apply function args)) - (end (current-time))) + (val (apply function args))) (message "%s ran in %g seconds" function - (float-time (time-subtract end start))) + (float-time (time-subtract nil start))) val)) (defun rng-time-tokenize-buffer () diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index cf7a4dbf38b..49519471b38 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -10153,7 +10153,7 @@ to override `appt-message-warning-time'." ;; time and without date as argument, so it may pass wrong ;; information otherwise (today (org-date-to-gregorian - (time-to-days (current-time)))) + (time-to-days nil))) (org-agenda-restrict nil) (files (org-agenda-files 'unrestricted)) entries file (org-agenda-buffer nil)) diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 9dc501500b1..eb7080bb8be 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -950,7 +950,7 @@ If necessary, clock-out of the currently active clock." (unless (org-is-active-clock clock) (org-clock-clock-in clock t)))) - ((not (time-less-p resolve-to (current-time))) + ((not (time-less-p resolve-to nil)) (error "RESOLVE-TO must refer to a time in the past")) (t @@ -1052,7 +1052,7 @@ to be CLOCKED OUT.")))) (and (not (memq char-pressed '(?i ?q))) char-pressed))))) (default (floor (/ (float-time - (time-subtract (current-time) last-valid)) 60))) + (time-subtract nil last-valid)) 60))) (keep (and (memq ch '(?k ?K)) (read-number "Keep how many minutes? " default))) @@ -1089,8 +1089,7 @@ to be CLOCKED OUT.")))) (keep (time-add last-valid (seconds-to-time (* 60 keep)))) (gotback - (time-subtract (current-time) - (seconds-to-time (* 60 gotback)))) + (time-subtract nil (seconds-to-time (* 60 gotback)))) (t (error "Unexpected, please report this as a bug"))) (and gotback last-valid) @@ -1172,7 +1171,7 @@ so long." org-clock-marker (marker-buffer org-clock-marker)) (let* ((org-clock-user-idle-seconds (org-user-idle-seconds)) (org-clock-user-idle-start - (time-subtract (current-time) + (time-subtract nil (seconds-to-time org-clock-user-idle-seconds))) (org-clock-resolving-clocks-due-to-idleness t)) (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time)) @@ -1182,8 +1181,7 @@ so long." (lambda (_) (format "Clocked in & idle for %.1f mins" (/ (float-time - (time-subtract (current-time) - org-clock-user-idle-start)) + (time-subtract nil org-clock-user-idle-start)) 60.0))) org-clock-user-idle-start))))) diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el index eac29c50f65..80f4929b95c 100644 --- a/lisp/org/org-colview.el +++ b/lisp/org/org-colview.el @@ -540,7 +540,7 @@ Where possible, use the standard interface for changing this line." (eol (line-end-position)) (pom (or (get-text-property bol 'org-hd-marker) (point))) (key (or key (get-char-property (point) 'org-columns-key))) - (org-columns--time (float-time (current-time))) + (org-columns--time (float-time)) (action (pcase key ("CLOCKSUM" @@ -790,7 +790,7 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column format." (org-columns-goto-top-level) ;; Initialize `org-columns-current-fmt' and ;; `org-columns-current-fmt-compiled'. - (let ((org-columns--time (float-time (current-time)))) + (let ((org-columns--time (float-time))) (org-columns-get-format columns-fmt-string) (unless org-columns-inhibit-recalculation (org-columns-compute-all)) (save-excursion @@ -1182,7 +1182,7 @@ column specification." "Compute all columns that have operators defined." (org-with-silent-modifications (remove-text-properties (point-min) (point-max) '(org-summaries t))) - (let ((org-columns--time (float-time (current-time))) + (let ((org-columns--time (float-time)) seen) (dolist (spec org-columns-current-fmt-compiled) (let ((property (car spec))) @@ -1494,7 +1494,7 @@ PARAMS is a property list of parameters: (if (markerp org-columns-begin-marker) (move-marker org-columns-begin-marker (point)) (setq org-columns-begin-marker (point-marker))) - (let* ((org-columns--time (float-time (current-time))) + (let* ((org-columns--time (float-time)) (fmt (cond ((bound-and-true-p org-agenda-overriding-columns-format)) diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el index f2b3002f1fd..73012cd2681 100644 --- a/lisp/org/org-element.el +++ b/lisp/org/org-element.el @@ -5067,7 +5067,7 @@ Assume ELEMENT belongs to cache and that a cache is active." TIME-LIMIT is a time value or nil." (and time-limit (or (input-pending-p) - (time-less-p time-limit (current-time))))) + (time-less-p time-limit nil)))) (defsubst org-element--cache-shift-positions (element offset &optional props) "Shift ELEMENT properties relative to buffer positions by OFFSET. @@ -5121,7 +5121,7 @@ updated before current modification are actually submitted." (and next (aref next 0)) threshold (and (not threshold) - (time-add (current-time) + (time-add nil org-element-cache-sync-duration)) future-change) ;; Request processed. Merge current and next offsets and diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el index 89b75e6f680..c867c840b0e 100644 --- a/lisp/org/org-habit.el +++ b/lisp/org/org-habit.el @@ -288,7 +288,7 @@ Habits are assigned colors on the following basis: (deadline (if scheduled-days (+ scheduled-days (- d-repeat s-repeat)) (org-habit-deadline habit))) - (m-days (or now-days (time-to-days (current-time))))) + (m-days (or now-days (time-to-days nil)))) (cond ((< m-days scheduled) '(org-habit-clear-face . org-habit-clear-future-face)) @@ -406,7 +406,7 @@ current time." "Insert consistency graph for any habitual tasks." (let ((inhibit-read-only t) (buffer-invisibility-spec '(org-link)) - (moment (time-subtract (current-time) + (moment (time-subtract nil (list 0 (* 3600 org-extend-today-until) 0)))) (save-excursion (goto-char (if line (point-at-bol) (point-min))) diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el index b34586e09ec..35c1f22719e 100644 --- a/lisp/org/org-indent.el +++ b/lisp/org/org-indent.el @@ -325,7 +325,7 @@ stopped." (let* ((case-fold-search t) (limited-re (org-get-limited-outline-regexp)) (level (or (org-current-level) 0)) - (time-limit (and delay (time-add (current-time) delay)))) + (time-limit (and delay (time-add nil delay)))) ;; For each line, set `line-prefix' and `wrap-prefix' ;; properties depending on the type of line (headline, inline ;; task, item or other). @@ -338,7 +338,7 @@ stopped." ;; In asynchronous mode, take a break of ;; `org-indent-agent-resume-delay' every DELAY to avoid ;; blocking any other idle timer or process output. - ((and delay (time-less-p time-limit (current-time))) + ((and delay (time-less-p time-limit nil)) (setq org-indent-agent-resume-timer (run-with-idle-timer (time-add (current-idle-time) org-indent-agent-resume-delay) diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el index 5acf526f183..7617a3810f9 100644 --- a/lisp/org/org-timer.el +++ b/lisp/org/org-timer.el @@ -144,7 +144,7 @@ the region 0:00:00." ;; Pass `current-time' result to `float-time' (instead ;; of calling without arguments) so that only ;; `current-time' has to be overridden in tests. - (- (float-time (current-time)) delta)))) + (- (float-time) delta)))) (setq org-timer-pause-time nil) (org-timer-set-mode-line 'on) (message "Timer start time set to %s, current value is %s" @@ -168,12 +168,12 @@ With prefix arg STOP, stop it entirely." (org-timer--run-countdown-timer new-secs org-timer-countdown-timer-title)) (setq org-timer-start-time - (time-add (current-time) (seconds-to-time new-secs)))) + (time-add nil (seconds-to-time new-secs)))) (setq org-timer-start-time ;; Pass `current-time' result to `float-time' (instead ;; of calling without arguments) so that only ;; `current-time' has to be overridden in tests. - (seconds-to-time (- (float-time (current-time)) + (seconds-to-time (- (float-time) (- pause-secs start-secs))))) (setq org-timer-pause-time nil) (org-timer-set-mode-line 'on) @@ -238,8 +238,8 @@ it in the buffer." ;; overridden in tests. (if org-timer-countdown-timer (- (float-time org-timer-start-time) - (float-time (or org-timer-pause-time (current-time)))) - (- (float-time (or org-timer-pause-time (current-time))) + (float-time org-timer-pause-time)) + (- (float-time org-timer-pause-time) (float-time org-timer-start-time)))) ;;;###autoload @@ -400,7 +400,7 @@ VALUE can be `on', `off', or `paused'." (message "No timer set") (let* ((rtime (decode-time (time-subtract (timer--time org-timer-countdown-timer) - (current-time)))) + nil))) (rsecs (nth 0 rtime)) (rmins (nth 1 rtime))) (message "%d minute(s) %d seconds left before next time out" @@ -464,7 +464,7 @@ using three `C-u' prefix arguments." secs org-timer-countdown-timer-title)) (run-hooks 'org-timer-set-hook) (setq org-timer-start-time - (time-add (current-time) (seconds-to-time secs))) + (time-add nil (seconds-to-time secs))) (setq org-timer-pause-time nil) (org-timer-set-mode-line 'on)))))) diff --git a/lisp/org/org.el b/lisp/org/org.el index 35405b4bf81..569bc9f8ec1 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -227,7 +227,7 @@ file to byte-code before it is loaded." (interactive "fFile to load: \nP") (let* ((age (lambda (file) (float-time - (time-subtract (current-time) + (time-subtract nil (nth 5 (or (file-attributes (file-truename file)) (file-attributes file))))))) (base-name (file-name-sans-extension file)) @@ -5597,15 +5597,14 @@ the rounding returns a past time." (apply 'encode-time (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r))))) (nthcdr 2 time)))) - (if (and past (< (float-time (time-subtract (current-time) res)) 0)) + (if (and past (< (float-time (time-subtract nil res)) 0)) (seconds-to-time (- (float-time res) (* r 60))) res)))) (defun org-today () "Return today date, considering `org-extend-today-until'." (time-to-days - (time-subtract (current-time) - (list 0 (* 3600 org-extend-today-until) 0)))) + (time-subtract nil (list 0 (* 3600 org-extend-today-until) 0)))) ;;;; Font-Lock stuff, including the activators @@ -13057,8 +13056,7 @@ This function is run automatically after each state change to a DONE state." (while (re-search-forward org-clock-line-re end t) (when (org-at-clock-log-p) (throw :clock t)))))) (org-entry-put nil "LAST_REPEAT" (format-time-string - (org-time-stamp-format t t) - (current-time)))) + (org-time-stamp-format t t)))) (when org-log-repeat (if (or (memq 'org-add-log-note (default-value 'post-command-hook)) (memq 'org-add-log-note post-command-hook)) @@ -13117,7 +13115,7 @@ has been set" (let ((nshiftmax 10) (nshift 0)) (while (or (= nshift 0) - (not (time-less-p (current-time) time))) + (not (time-less-p nil time))) (when (= (cl-incf nshift) nshiftmax) (or (y-or-n-p (format "%d repeater intervals were not \ @@ -16904,7 +16902,7 @@ user." ;; overridden in tests. (let ((org-def def) (org-defdecode defdecode) - (nowdecode (decode-time (current-time))) + (nowdecode (decode-time)) delta deltan deltaw deltadef year month day hour minute second wday pm h2 m2 tl wday1 iso-year iso-weekday iso-week iso-date futurep kill-year) @@ -17070,7 +17068,7 @@ user." ; (when (and org-read-date-prefer-future ; (not iso-year) ; (< (calendar-absolute-from-gregorian iso-date) - ; (time-to-days (current-time)))) + ; (time-to-days nil))) ; (setq year (1+ year) ; iso-date (calendar-gregorian-from-absolute ; (calendar-iso-to-absolute @@ -17084,7 +17082,7 @@ user." ;; Pass `current-time' result to `decode-time' (instead of ;; calling without arguments) so that only `current-time' has ;; to be overridden in tests. - (let ((now (decode-time (current-time)))) + (let ((now (decode-time))) (setq day (nth 3 now) month (nth 4 now) year (nth 5 now)))) (cond ((member deltaw '("d" "")) (setq day (+ day deltan))) ((equal deltaw "w") (setq day (+ day (* 7 deltan)))) @@ -17564,7 +17562,7 @@ signaled." YEAR is expanded into one of the 30 next years, if possible, or into a past one. Any year larger than 99 is returned unchanged." (if (>= year 100) year - (let* ((current (string-to-number (format-time-string "%Y" (current-time)))) + (let* ((current (string-to-number (format-time-string "%Y"))) (century (/ current 100)) (offset (- year (% current 100)))) (cond ((> offset 30) (+ (* (1- century) 100) year)) @@ -18088,7 +18086,7 @@ A prefix ARG can be used to force the current date." diff) (when (or (org-at-timestamp-p 'lax) (org-match-line (concat ".*" org-ts-regexp))) - (let ((d1 (time-to-days (current-time))) + (let ((d1 (time-to-days nil)) (d2 (time-to-days (org-time-string-to-time (match-string 1))))) (setq diff (- d2 d1)))) (calendar) diff --git a/lisp/org/ox.el b/lisp/org/ox.el index 1c43577cddf..820b1755624 100644 --- a/lisp/org/ox.el +++ b/lisp/org/ox.el @@ -3243,7 +3243,7 @@ locally for the subtree through node properties." (let ((val (cond ((equal (car key) "DATE") (or (cdr key) (with-temp-buffer - (org-insert-time-stamp (current-time))))) + (org-insert-time-stamp nil)))) ((equal (car key) "TITLE") (or (let ((visited-file (buffer-file-name (buffer-base-buffer)))) diff --git a/lisp/time.el b/lisp/time.el index c8726a9a1b0..6cd7320e72f 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -583,7 +583,7 @@ For example, the Unix uptime command format is \"%D, %z%2h:%.2m\"." (let ((str (format-seconds (or format "%Y, %D, %H, %M, %z%S") (float-time - (time-subtract (current-time) before-init-time))))) + (time-subtract nil before-init-time))))) (if (called-interactively-p 'interactive) (message "%s" str) str))) diff --git a/lisp/type-break.el b/lisp/type-break.el index faf44b3b875..35b0efe65b1 100644 --- a/lisp/type-break.el +++ b/lisp/type-break.el @@ -376,7 +376,7 @@ problems." (if (and type-break-time-last-break (< (setq diff (type-break-time-difference type-break-time-last-break - (current-time))) + nil)) type-break-interval)) ;; Use the file's value. (progn @@ -563,7 +563,7 @@ as per the function `type-break-schedule'." (cond (good-interval (let ((break-secs (type-break-time-difference - start-time (current-time)))) + start-time nil))) (cond ((>= break-secs good-interval) (setq continue nil)) @@ -624,7 +624,7 @@ INTERVAL is the full length of an interval (defaults to TIME)." type-break-time-warning-intervals)) (or time - (setq time (type-break-time-difference (current-time) + (setq time (type-break-time-difference nil type-break-time-next-break))) (while (and type-break-current-time-warning-interval @@ -685,7 +685,7 @@ keystroke threshold has been exceeded." (and type-break-good-rest-interval (progn (and (> (type-break-time-difference - type-break-time-last-command (current-time)) + type-break-time-last-command nil) type-break-good-rest-interval) (progn (type-break-keystroke-reset) diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el index 1cffc06d7c3..963dfd531e2 100644 --- a/lisp/url/url-cache.el +++ b/lisp/url/url-cache.el @@ -206,7 +206,7 @@ If `url-standalone-mode' is non-nil, cached items never expire." (time-add cache-time (seconds-to-time (or expire-time url-cache-expire-time))) - (current-time)))))) + nil))))) (defun url-cache-prune-cache (&optional directory) "Remove all expired files from the cache. diff --git a/lisp/url/url.el b/lisp/url/url.el index 9a6b732ca9c..36cd81bd70b 100644 --- a/lisp/url/url.el +++ b/lisp/url/url.el @@ -259,8 +259,7 @@ how long to wait for a response before giving up." ;; process output. (while (and (not retrieval-done) (or (not timeout) - (< (float-time (time-subtract - (current-time) start-time)) + (< (float-time (time-subtract nil start-time)) timeout))) (url-debug 'retrieval "Spinning in url-retrieve-synchronously: %S (%S)" diff --git a/test/lisp/char-fold-tests.el b/test/lisp/char-fold-tests.el index 83d6fa79b1e..a16f2879809 100644 --- a/test/lisp/char-fold-tests.el +++ b/test/lisp/char-fold-tests.el @@ -117,16 +117,14 @@ (char-fold-to-regexp string))) (with-temp-buffer (save-excursion (insert string)) - (let ((time (time-to-seconds (current-time)))) + (let ((time (time-to-seconds))) ;; Our initial implementation of case-folding in char-folding ;; created a lot of redundant paths in the regexp. Because of ;; that, if a really long string "almost" matches, the regexp ;; engine took a long time to realize that it doesn't match. (should-not (char-fold-search-forward (concat string "c") nil 'noerror)) ;; Ensure it took less than a second. - (should (< (- (time-to-seconds (current-time)) - time) - 1)))))) + (should (< (- (time-to-seconds) time) 1)))))) (provide 'char-fold-tests) ;;; char-fold-tests.el ends here diff --git a/test/manual/cedet/semantic-ia-utest.el b/test/manual/cedet/semantic-ia-utest.el index 7861fd73949..53cff05adc4 100644 --- a/test/manual/cedet/semantic-ia-utest.el +++ b/test/manual/cedet/semantic-ia-utest.el @@ -434,7 +434,7 @@ tag that contains point, and return that." (when (interactive-p) (message "Found %d occurrences of %s in %.2f seconds" Lcount (semantic-tag-name target) - (semantic-elapsed-time start (current-time)))) + (semantic-elapsed-time start nil))) Lcount))) (defun semantic-src-utest-buffer-refs () diff --git a/test/manual/cedet/semantic-tests.el b/test/manual/cedet/semantic-tests.el index 3a19328ac79..0495170058a 100644 --- a/test/manual/cedet/semantic-tests.el +++ b/test/manual/cedet/semantic-tests.el @@ -178,9 +178,8 @@ Optional argument ARG specifies not to use color." "Test `semantic-idle-scheduler-work-parse-neighboring-files' and time it." (interactive) (let ((start (current-time)) - (junk (semantic-idle-scheduler-work-parse-neighboring-files)) - (end (current-time))) - (message "Work took %.2f seconds." (semantic-elapsed-time start end)))) + (junk (semantic-idle-scheduler-work-parse-neighboring-files))) + (message "Work took %.2f seconds." (semantic-elapsed-time start nil)))) ;;; From semantic-lex: @@ -195,10 +194,9 @@ If universal argument ARG, then try the whole buffer." (result (semantic-lex (if arg (point-min) (point)) (point-max) - 100)) - (end (current-time))) + 100))) (message "Elapsed Time: %.2f seconds." - (semantic-elapsed-time start end)) + (semantic-elapsed-time start nil)) (pop-to-buffer "*Lexer Output*") (require 'pp) (erase-buffer) @@ -278,7 +276,7 @@ tag that contains point, and return that." (when (interactive-p) (message "Found %d occurrences of %s in %.2f seconds" Lcount (semantic-tag-name target) - (semantic-elapsed-time start (current-time)))) + (semantic-elapsed-time start nil))) Lcount))) ;;; From bovine-gcc: