aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2019-02-22 18:32:31 -0800
committerPaul Eggert2019-02-22 18:33:57 -0800
commit476066e89d6f0bb87220da690b8a476bf9655b80 (patch)
tree5b79293c40ba0f54544d803a02fbec7310f04a0e
parenteba66c1eafeef6512259c9b46face2b03c7433b8 (diff)
downloademacs-476066e89d6f0bb87220da690b8a476bf9655b80.tar.gz
emacs-476066e89d6f0bb87220da690b8a476bf9655b80.zip
Avoid some double-rounding of Lisp timestamps
Also, simplify some time-related Lisp timestamp code while we’re in the neighborhood. * lisp/battery.el (battery-linux-proc-acpi) (battery-linux-sysfs, battery-upower, battery-bsd-apm): * lisp/calendar/timeclock.el (timeclock-seconds-to-string) (timeclock-log, timeclock-last-period) (timeclock-entry-length, timeclock-entry-list-span) (timeclock-find-discrep, timeclock-generate-report): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/completion.el (cmpl-hours-since-origin): * lisp/ecomplete.el (ecomplete-decay-1): * lisp/emacs-lisp/ert.el (ert--results-update-stats-display) (ert--results-update-stats-display-maybe): * lisp/emacs-lisp/timer-list.el (list-timers): * lisp/emacs-lisp/timer.el (timer-until) (timer-event-handler): * lisp/erc/erc-backend.el (erc-server-send-ping) (erc-server-send-queue, erc-handle-parsed-server-response) (erc-handle-unknown-server-response): * lisp/erc/erc-track.el (erc-buffer-visible): * lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p) (erc-cmd-PING, erc-send-current-line): * lisp/eshell/em-pred.el (eshell-pred-file-time): * lisp/eshell/em-unix.el (eshell-show-elapsed-time): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp): * lisp/gnus/gnus-int.el (gnus-backend-trace): * lisp/gnus/gnus-sum.el (gnus-user-date): * lisp/gnus/mail-source.el (mail-source-delete-crash-box): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/ibuf-ext.el (ibuffer-mark-old-buffers): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/mouse.el (mouse--down-1-maybe-follows-link) (mouse--click-1-maybe-follows-link): * lisp/mpc.el (mpc--faster-toggle): * lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE) (rcirc-sentinel): * lisp/net/tramp-cache.el (tramp-get-file-property): * lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p) (tramp-maybe-open-connection): * lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): * lisp/org/org-clock.el (org-clock-resolve): (org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum): * lisp/org/org-timer.el (org-timer-start) (org-timer-pause-or-continue, org-timer-seconds): * lisp/org/org.el (org-evaluate-time-range): * lisp/org/ox-publish.el (org-publish-cache-ctime-of-src): * lisp/pixel-scroll.el (pixel-scroll-in-rush-p): * lisp/play/hanoi.el (hanoi-move-ring): * lisp/proced.el (proced-format-time): * lisp/progmodes/cpp.el (cpp-progress-message): * lisp/progmodes/flymake.el (flymake--handle-report): * lisp/progmodes/js.el (js--wait-for-matching-output): * lisp/subr.el (progress-reporter-do-update): * lisp/term/xterm.el (xterm--read-event-for-query): * lisp/time.el (display-time-update, emacs-uptime): * lisp/tooltip.el (tooltip-delay): * lisp/url/url-cookie.el (url-cookie-parse-file-netscape): * lisp/url/url-queue.el (url-queue-prune-old-entries): * lisp/url/url.el (url-retrieve-synchronously): * lisp/xt-mouse.el (xterm-mouse-event): Avoid double-rounding of time-related values. Simplify. * lisp/calendar/icalendar.el (icalendar--decode-isodatetime): When hoping for the best (unlikely), use a better decoded time. (icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time. * lisp/calendar/timeclock.el (timeclock-when-to-leave): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/desktop.el (desktop-create-buffer): * lisp/emacs-lisp/benchmark.el (benchmark-elapse): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/nnmail.el (nnmail-expired-article-p): * lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles): * lisp/nxml/rng-maint.el (rng-time-function): * lisp/org/org-clock.el (org-clock-get-clocked-time) (org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle): * lisp/org/org-habit.el (org-habit-insert-consistency-graphs): * lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info) (vhdl-fix-case-region-1): Use time-since instead of open-coding most of it. * lisp/erc/erc-dcc.el (erc-dcc-get-sentinel): * lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt): Now obsolete. All uses changed. (erc-time-diff): Accept all Lisp time values. All uses changed. * lisp/gnus/gnus-demon.el (gnus-demon-idle-since): * lisp/gnus/gnus-score.el (gnus-score-headers): * lisp/gnus/nneething.el (nneething-make-head): * lisp/gnus/nnheader.el (nnheader-message-maybe): * lisp/gnus/nnimap.el (nnimap-keepalive): * lisp/image.el (image-animate-timeout): * lisp/mail/feedmail.el (feedmail-rfc822-date): * lisp/net/imap.el (imap-wait-for-tag): * lisp/net/newst-backend.el (newsticker--image-get): * lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333): * lisp/obsolete/xesam.el (xesam-refresh-entry): * lisp/org/org-agenda.el (org-agenda-show-clocking-issues) (org-agenda-check-clock-gap, org-agenda-to-appt): * lisp/org/org-capture.el (org-capture-set-target-location): * lisp/org/org-clock.el (org-clock-resolve-clock) (org-clocktable-steps): * lisp/org/org-colview.el (org-columns-edit-value) (org-columns, org-agenda-columns): * lisp/org/org-duration.el (org-duration-from-minutes): * lisp/org/org-element.el (org-element-cache-sync-duration) (org-element-cache-sync-break) (org-element--cache-interrupt-p, org-element--cache-sync): * lisp/org/org-habit.el (org-habit-get-faces) * lisp/org/org-indent.el (org-indent-add-properties): * lisp/org/org-table.el (org-table-sum): * lisp/org/org-timer.el (org-timer-show-remaining-time) (org-timer-set-timer): * lisp/org/org.el (org-babel-load-file, org-today) (org-auto-repeat-maybe, org-2ft, org-time-stamp) (org-read-date-analyze, org-time-stamp-to-now) (org-small-year-to-year, org-goto-calendar): * lisp/org/ox.el (org-export-insert-default-template): * lisp/ses.el (ses--time-check): * lisp/type-break.el (type-break-time-warning) (type-break-statistics, type-break-demo-boring): * lisp/url/url-cache.el (url-cache-expired) (url-cache-prune-cache): * lisp/vc/vc-git.el (vc-git-stash-snapshot): * lisp/erc/erc-match.el (erc-log-matches-come-back): Simplify.
-rw-r--r--lisp/battery.el30
-rw-r--r--lisp/calendar/cal-dst.el2
-rw-r--r--lisp/calendar/icalendar.el20
-rw-r--r--lisp/calendar/timeclock.el57
-rw-r--r--lisp/cedet/ede/detect.el2
-rw-r--r--lisp/completion.el2
-rw-r--r--lisp/desktop.el8
-rw-r--r--lisp/ecomplete.el2
-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
-rw-r--r--lisp/erc/erc-backend.el30
-rw-r--r--lisp/erc/erc-dcc.el2
-rw-r--r--lisp/erc/erc-match.el2
-rw-r--r--lisp/erc/erc-track.el4
-rw-r--r--lisp/erc/erc.el41
-rw-r--r--lisp/eshell/em-pred.el15
-rw-r--r--lisp/eshell/em-unix.el3
-rw-r--r--lisp/gnus/gnus-art.el2
-rw-r--r--lisp/gnus/gnus-demon.el2
-rw-r--r--lisp/gnus/gnus-group.el2
-rw-r--r--lisp/gnus/gnus-icalendar.el9
-rw-r--r--lisp/gnus/gnus-int.el3
-rw-r--r--lisp/gnus/gnus-score.el4
-rw-r--r--lisp/gnus/gnus-sum.el14
-rw-r--r--lisp/gnus/mail-source.el6
-rw-r--r--lisp/gnus/nneething.el2
-rw-r--r--lisp/gnus/nnheader.el2
-rw-r--r--lisp/gnus/nnimap.el12
-rw-r--r--lisp/gnus/nnmail.el2
-rw-r--r--lisp/gnus/nnmaildir.el4
-rw-r--r--lisp/ibuf-ext.el7
-rw-r--r--lisp/image.el13
-rw-r--r--lisp/mail/feedmail.el2
-rw-r--r--lisp/mouse.el8
-rw-r--r--lisp/mpc.el11
-rw-r--r--lisp/net/imap.el6
-rw-r--r--lisp/net/newst-backend.el5
-rw-r--r--lisp/net/rcirc.el14
-rw-r--r--lisp/net/tramp-cache.el5
-rw-r--r--lisp/net/tramp-sh.el21
-rw-r--r--lisp/net/tramp-smb.el9
-rw-r--r--lisp/nxml/rng-maint.el3
-rw-r--r--lisp/obsolete/xesam.el3
-rw-r--r--lisp/org/org-agenda.el11
-rw-r--r--lisp/org/org-capture.el3
-rw-r--r--lisp/org/org-clock.el58
-rw-r--r--lisp/org/org-colview.el6
-rw-r--r--lisp/org/org-duration.el9
-rw-r--r--lisp/org/org-element.el9
-rw-r--r--lisp/org/org-habit.el5
-rw-r--r--lisp/org/org-indent.el4
-rw-r--r--lisp/org/org-table.el4
-rw-r--r--lisp/org/org-timer.el32
-rw-r--r--lisp/org/org.el56
-rw-r--r--lisp/org/ox-publish.el2
-rw-r--r--lisp/org/ox.el2
-rw-r--r--lisp/pixel-scroll.el9
-rw-r--r--lisp/play/hanoi.el2
-rw-r--r--lisp/proced.el2
-rw-r--r--lisp/progmodes/cpp.el4
-rw-r--r--lisp/progmodes/flymake.el3
-rw-r--r--lisp/progmodes/js.el4
-rw-r--r--lisp/progmodes/vhdl-mode.el4
-rw-r--r--lisp/ses.el2
-rw-r--r--lisp/subr.el2
-rw-r--r--lisp/term/xterm.el8
-rw-r--r--lisp/time.el18
-rw-r--r--lisp/tooltip.el3
-rw-r--r--lisp/type-break.el14
-rw-r--r--lisp/url/url-cache.el4
-rw-r--r--lisp/url/url-cookie.el9
-rw-r--r--lisp/url/url-queue.el4
-rw-r--r--lisp/url/url.el3
-rw-r--r--lisp/vc/vc-git.el5
-rw-r--r--lisp/woman.el2
-rw-r--r--lisp/xt-mouse.el9
78 files changed, 338 insertions, 395 deletions
diff --git a/lisp/battery.el b/lisp/battery.el
index c21ba767fe4..efd2a2181af 100644
--- a/lisp/battery.el
+++ b/lisp/battery.el
@@ -375,12 +375,12 @@ The following %-sequences are provided:
375 last-full-capacity design-capacity)) 375 last-full-capacity design-capacity))
376 (and capacity rate 376 (and capacity rate
377 (setq minutes (if (zerop rate) 0 377 (setq minutes (if (zerop rate) 0
378 (floor (* (/ (float (if (string= charging-state 378 (floor (* (if (string= charging-state
379 "charging") 379 "charging")
380 (- full-capacity capacity) 380 (- full-capacity capacity)
381 capacity)) 381 capacity)
382 rate) 382 60)
383 60))) 383 rate))
384 hours (/ minutes 60))) 384 hours (/ minutes 60)))
385 (list (cons ?c (or (and capacity (number-to-string capacity)) "N/A")) 385 (list (cons ?c (or (and capacity (number-to-string capacity)) "N/A"))
386 (cons ?L (or (battery-search-for-one-match-in-files 386 (cons ?L (or (battery-search-for-one-match-in-files
@@ -414,8 +414,7 @@ The following %-sequences are provided:
414 (cons ?p (or (and full-capacity capacity 414 (cons ?p (or (and full-capacity capacity
415 (> full-capacity 0) 415 (> full-capacity 0)
416 (number-to-string 416 (number-to-string
417 (floor (/ capacity 417 (floor (* 100 capacity) full-capacity)))
418 (/ (float full-capacity) 100)))))
419 "N/A"))))) 418 "N/A")))))
420 419
421 420
@@ -471,9 +470,9 @@ The following %-sequences are provided:
471 "POWER_SUPPLY_\\(CURRENT\\|POWER\\)_NOW=\\([0-9]*\\)$" 470 "POWER_SUPPLY_\\(CURRENT\\|POWER\\)_NOW=\\([0-9]*\\)$"
472 nil t) 471 nil t)
473 (cl-incf power-now 472 (cl-incf power-now
474 (* (float (string-to-number (match-string 2))) 473 (* (string-to-number (match-string 2))
475 (if (eq (char-after (match-beginning 1)) ?C) 474 (if (eq (char-after (match-beginning 1)) ?C)
476 voltage-now 1.0)))) 475 voltage-now 1))))
477 (goto-char (point-min)) 476 (goto-char (point-min))
478 (when (re-search-forward "POWER_SUPPLY_TEMP=\\([0-9]*\\)$" nil t) 477 (when (re-search-forward "POWER_SUPPLY_TEMP=\\([0-9]*\\)$" nil t)
479 (setq temperature (match-string 1))) 478 (setq temperature (match-string 1)))
@@ -585,9 +584,7 @@ The following %-sequences are provided:
585 (when seconds 584 (when seconds
586 (setq minutes (/ seconds 60) 585 (setq minutes (/ seconds 60)
587 hours (/ minutes 60) 586 hours (/ minutes 60)
588 remaining-time 587 remaining-time (format "%d:%02d" hours (mod minutes 60))))
589 (format "%d:%02d" (truncate hours)
590 (- (truncate minutes) (* 60 (truncate hours))))))
591 (list (cons ?c (or (and energy 588 (list (cons ?c (or (and energy
592 (number-to-string (round (* 1000 energy)))) 589 (number-to-string (round (* 1000 energy))))
593 "N/A")) 590 "N/A"))
@@ -656,10 +653,9 @@ The following %-sequences are provided:
656 (setq minutes (string-to-number battery-life) 653 (setq minutes (string-to-number battery-life)
657 seconds (* 60 minutes)) 654 seconds (* 60 minutes))
658 (setq seconds (string-to-number battery-life) 655 (setq seconds (string-to-number battery-life)
659 minutes (truncate (/ seconds 60)))) 656 minutes (truncate seconds 60)))
660 (setq hours (truncate (/ minutes 60)) 657 (setq hours (truncate minutes 60)
661 remaining-time (format "%d:%02d" hours 658 remaining-time (format "%d:%02d" hours (mod minutes 60))))
662 (- minutes (* 60 hours)))))
663 (list (cons ?L (or line-status "N/A")) 659 (list (cons ?L (or line-status "N/A"))
664 (cons ?B (or (car battery-status) "N/A")) 660 (cons ?B (or (car battery-status) "N/A"))
665 (cons ?b (or (cdr battery-status) "N/A")) 661 (cons ?b (or (cdr battery-status) "N/A"))
diff --git a/lisp/calendar/cal-dst.el b/lisp/calendar/cal-dst.el
index 57747c64f66..2126cfdadb1 100644
--- a/lisp/calendar/cal-dst.el
+++ b/lisp/calendar/cal-dst.el
@@ -231,7 +231,7 @@ The result has the proper form for `calendar-daylight-savings-starts'."
231;; https://lists.gnu.org/r/emacs-pretest-bug/2006-11/msg00060.html 231;; https://lists.gnu.org/r/emacs-pretest-bug/2006-11/msg00060.html
232(defun calendar-dst-find-data (&optional time) 232(defun calendar-dst-find-data (&optional time)
233 "Find data on the first daylight saving time transitions after TIME. 233 "Find data on the first daylight saving time transitions after TIME.
234TIME defaults to `current-time'. Return value is as described 234TIME defaults to the current time. Return value is as described
235for `calendar-current-time-zone'." 235for `calendar-current-time-zone'."
236 (let* ((t0 (or time (current-time))) 236 (let* ((t0 (or time (current-time)))
237 (t0-zone (current-time-zone t0)) 237 (t0-zone (current-time-zone t0))
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index 31ace6fb9be..a8fd765129e 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -643,12 +643,14 @@ FIXME: multiple comma-separated values should be allowed!"
643 (setq year (nth 2 mdy)))) 643 (setq year (nth 2 mdy))))
644 ;; create the decoded date-time 644 ;; create the decoded date-time
645 ;; FIXME!?! 645 ;; FIXME!?!
646 (condition-case nil 646 (let ((decoded-time (list second minute hour day month year
647 (decode-time (encode-time second minute hour day month year zone)) 647 nil -1 zone)))
648 (error 648 (condition-case nil
649 (message "Cannot decode \"%s\"" isodatetimestring) 649 (decode-time (encode-time decoded-time 'integer))
650 ;; hope for the best... 650 (error
651 (list second minute hour day month year 0 nil 0)))) 651 (message "Cannot decode \"%s\"" isodatetimestring)
652 ;; Hope for the best....
653 decoded-time))))
652 ;; isodatetimestring == nil 654 ;; isodatetimestring == nil
653 nil)) 655 nil))
654 656
@@ -1596,8 +1598,7 @@ regular expression matching the start of non-marking entries.
1596ENTRY-MAIN is the first line of the diary entry. 1598ENTRY-MAIN is the first line of the diary entry.
1597 1599
1598Optional argument START determines the first day of the 1600Optional argument START determines the first day of the
1599enumeration, given as a time value, in same format as returned by 1601enumeration, given as a Lisp time value -- used for test purposes."
1600`current-time' -- used for test purposes."
1601 (cond ((string-match (concat nonmarker 1602 (cond ((string-match (concat nonmarker
1602 "%%(and \\(([^)]+)\\))\\(\\s-*.*?\\) ?$") 1603 "%%(and \\(([^)]+)\\))\\(\\s-*.*?\\) ?$")
1603 entry-main) 1604 entry-main)
@@ -1621,8 +1622,7 @@ enumeration, given as a time value, in same format as returned by
1621 (mapcar 1622 (mapcar
1622 (lambda (offset) 1623 (lambda (offset)
1623 (let* ((day (decode-time (time-add now 1624 (let* ((day (decode-time (time-add now
1624 (encode-time 1625 (* 60 60 24 offset))))
1625 (* offset 60 60 24)))))
1626 (d (nth 3 day)) 1626 (d (nth 3 day))
1627 (m (nth 4 day)) 1627 (m (nth 4 day))
1628 (y (nth 5 day)) 1628 (y (nth 5 day))
diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el
index 5c3580dd848..a896df5e57c 100644
--- a/lisp/calendar/timeclock.el
+++ b/lisp/calendar/timeclock.el
@@ -467,16 +467,10 @@ include the second count. If REVERSE-LEADER is non-nil, it means to
467output a \"+\" if the time value is negative, rather than a \"-\". 467output a \"+\" if the time value is negative, rather than a \"-\".
468This is used when negative time values have an inverted meaning (such 468This is used when negative time values have an inverted meaning (such
469as with time remaining, where negative time really means overtime)." 469as with time remaining, where negative time really means overtime)."
470 (if show-seconds 470 (let ((s (abs (truncate seconds))))
471 (format "%s%d:%02d:%02d" 471 (format (if show-seconds "%s%d:%02d:%02d" "%s%d:%02d")
472 (if (< seconds 0) (if reverse-leader "+" "-") "")
473 (truncate (/ (abs seconds) 60 60))
474 (% (truncate (/ (abs seconds) 60)) 60)
475 (% (truncate (abs seconds)) 60))
476 (format "%s%d:%02d"
477 (if (< seconds 0) (if reverse-leader "+" "-") "") 472 (if (< seconds 0) (if reverse-leader "+" "-") "")
478 (truncate (/ (abs seconds) 60 60)) 473 (/ s 3600) (% (/ s 60) 60) (% s 60))))
479 (% (truncate (/ (abs seconds) 60)) 60))))
480 474
481(defsubst timeclock-currently-in-p () 475(defsubst timeclock-currently-in-p ()
482 "Return non-nil if the user is currently clocked in." 476 "Return non-nil if the user is currently clocked in."
@@ -528,13 +522,12 @@ non-nil, the amount returned will be relative to past time worked."
528 "Return a time value representing the end of today's workday. 522 "Return a time value representing the end of today's workday.
529If TODAY-ONLY is non-nil, the value returned will be relative only to 523If TODAY-ONLY is non-nil, the value returned will be relative only to
530the time worked today, and not to past time." 524the time worked today, and not to past time."
531 (time-subtract nil 525 (time-since (let ((discrep (timeclock-find-discrep)))
532 (let ((discrep (timeclock-find-discrep))) 526 (if discrep
533 (if discrep 527 (if today-only
534 (if today-only 528 (cadr discrep)
535 (cadr discrep) 529 (car discrep))
536 (car discrep)) 530 0))))
537 0))))
538 531
539;;;###autoload 532;;;###autoload
540(defun timeclock-when-to-leave-string (&optional show-seconds 533(defun timeclock-when-to-leave-string (&optional show-seconds
@@ -671,8 +664,8 @@ being logged for. Normally only \"in\" events specify a project."
671 "\n") 664 "\n")
672 (if (equal (downcase code) "o") 665 (if (equal (downcase code) "o")
673 (setq timeclock-last-period 666 (setq timeclock-last-period
674 (- (float-time now) 667 (float-time
675 (float-time (cadr timeclock-last-event))) 668 (time-subtract now (cadr timeclock-last-event)))
676 timeclock-discrepancy 669 timeclock-discrepancy
677 (+ timeclock-discrepancy 670 (+ timeclock-discrepancy
678 timeclock-last-period))) 671 timeclock-last-period)))
@@ -707,8 +700,7 @@ recorded to disk. If MOMENT is non-nil, use that as the current time.
707This is only provided for coherency when used by 700This is only provided for coherency when used by
708`timeclock-discrepancy'." 701`timeclock-discrepancy'."
709 (if (equal (car timeclock-last-event) "i") 702 (if (equal (car timeclock-last-event) "i")
710 (- (float-time moment) 703 (float-time (time-subtract moment (cadr timeclock-last-event)))
711 (float-time (cadr timeclock-last-event)))
712 timeclock-last-period)) 704 timeclock-last-period))
713 705
714(cl-defstruct (timeclock-entry 706(cl-defstruct (timeclock-entry
@@ -721,8 +713,7 @@ This is only provided for coherency when used by
721 713
722(defsubst timeclock-entry-length (entry) 714(defsubst timeclock-entry-length (entry)
723 "Return the length of ENTRY in seconds." 715 "Return the length of ENTRY in seconds."
724 (- (float-time (cadr entry)) 716 (float-time (time-subtract (cadr entry) (car entry))))
725 (float-time (car entry))))
726 717
727(defsubst timeclock-entry-list-length (entry-list) 718(defsubst timeclock-entry-list-length (entry-list)
728 "Return the total length of ENTRY-LIST in seconds." 719 "Return the total length of ENTRY-LIST in seconds."
@@ -741,8 +732,8 @@ This is only provided for coherency when used by
741 732
742(defsubst timeclock-entry-list-span (entry-list) 733(defsubst timeclock-entry-list-span (entry-list)
743 "Return the total time in seconds spanned by ENTRY-LIST." 734 "Return the total time in seconds spanned by ENTRY-LIST."
744 (- (float-time (timeclock-entry-list-end entry-list)) 735 (float-time (time-subtract (timeclock-entry-list-end entry-list)
745 (float-time (timeclock-entry-list-begin entry-list)))) 736 (timeclock-entry-list-begin entry-list))))
746 737
747(defsubst timeclock-entry-list-break (entry-list) 738(defsubst timeclock-entry-list-break (entry-list)
748 "Return the total break time (span - length) in ENTRY-LIST." 739 "Return the total break time (span - length) in ENTRY-LIST."
@@ -1109,7 +1100,7 @@ discrepancy, today's discrepancy, and the time worked today."
1109 last-date-limited nil) 1100 last-date-limited nil)
1110 (if beg 1101 (if beg
1111 (error "Error in format of timelog file!") 1102 (error "Error in format of timelog file!")
1112 (setq beg (float-time (cadr event)))))) 1103 (setq beg (cadr event)))))
1113 ((equal (downcase (car event)) "o") 1104 ((equal (downcase (car event)) "o")
1114 (if (and (nth 2 event) 1105 (if (and (nth 2 event)
1115 (> (length (nth 2 event)) 0)) 1106 (> (length (nth 2 event)) 0))
@@ -1117,7 +1108,7 @@ discrepancy, today's discrepancy, and the time worked today."
1117 (if (not beg) 1108 (if (not beg)
1118 (error "Error in format of timelog file!") 1109 (error "Error in format of timelog file!")
1119 (setq timeclock-last-period 1110 (setq timeclock-last-period
1120 (- (float-time (cadr event)) beg) 1111 (float-time (time-subtract (cadr event) beg))
1121 accum (+ timeclock-last-period accum) 1112 accum (+ timeclock-last-period accum)
1122 beg nil)) 1113 beg nil))
1123 (if (equal last-date todays-date) 1114 (if (equal last-date todays-date)
@@ -1262,12 +1253,11 @@ HTML-P is non-nil, HTML markup is added."
1262 (unless (time-less-p 1253 (unless (time-less-p
1263 (timeclock-day-begin day) 1254 (timeclock-day-begin day)
1264 (aref lengths i)) 1255 (aref lengths i))
1265 (let ((base (float-time 1256 (let ((base (timeclock-day-base (timeclock-day-begin day))))
1266 (timeclock-day-base
1267 (timeclock-day-begin day)))))
1268 (nconc (aref time-in i) 1257 (nconc (aref time-in i)
1269 (list (- (float-time (timeclock-day-begin day)) 1258 (list (float-time (time-subtract
1270 base))) 1259 (timeclock-day-begin day)
1260 base))))
1271 (let ((span (timeclock-day-span day)) 1261 (let ((span (timeclock-day-span day))
1272 (len (timeclock-day-length day)) 1262 (len (timeclock-day-length day))
1273 (req (timeclock-day-required day))) 1263 (req (timeclock-day-required day)))
@@ -1278,8 +1268,9 @@ HTML-P is non-nil, HTML markup is added."
1278 (when (and (> span 0) 1268 (when (and (> span 0)
1279 (> (/ (float len) (float span)) 0.70)) 1269 (> (/ (float len) (float span)) 0.70))
1280 (nconc (aref time-out i) 1270 (nconc (aref time-out i)
1281 (list (- (float-time (timeclock-day-end day)) 1271 (list (float-time (time-subtract
1282 base))) 1272 (timeclock-day-end day)
1273 base))))
1283 (nconc (aref breaks i) (list (- span len)))) 1274 (nconc (aref breaks i) (list (- span len))))
1284 (if req 1275 (if req
1285 (setq len (+ len (- timeclock-workday req)))) 1276 (setq len (+ len (- timeclock-workday req))))
diff --git a/lisp/cedet/ede/detect.el b/lisp/cedet/ede/detect.el
index daffb6eb5a8..e33f7a9a0fe 100644
--- a/lisp/cedet/ede/detect.el
+++ b/lisp/cedet/ede/detect.el
@@ -198,7 +198,7 @@ Return a cons cell:
198 (ans (ede-detect-directory-for-project default-directory))) 198 (ans (ede-detect-directory-for-project default-directory)))
199 (if ans 199 (if ans
200 (message "Project found in %d sec @ %s of type %s" 200 (message "Project found in %d sec @ %s of type %s"
201 (float-time (time-subtract nil start)) 201 (encode-time (time-since start) 'integer)
202 (car ans) 202 (car ans)
203 (eieio-object-name-string (cdr ans))) 203 (eieio-object-name-string (cdr ans)))
204 (message "No Project found.") ))) 204 (message "No Project found.") )))
diff --git a/lisp/completion.el b/lisp/completion.el
index 1073ae89156..89285c74d41 100644
--- a/lisp/completion.el
+++ b/lisp/completion.el
@@ -432,7 +432,7 @@ Used to decide whether to save completions.")
432 432
433 433
434(defun cmpl-hours-since-origin () 434(defun cmpl-hours-since-origin ()
435 (floor (float-time) 3600)) 435 (floor (encode-time nil 'integer) 3600))
436 436
437;;--------------------------------------------------------------------------- 437;;---------------------------------------------------------------------------
438;; "Symbol" parsing functions 438;; "Symbol" parsing functions
diff --git a/lisp/desktop.el b/lisp/desktop.el
index a431d044b5f..acabde5eb2f 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -1544,10 +1544,10 @@ and try to load that."
1544 ;; for the sake of `clean-buffer-list': preserving the invariant 1544 ;; for the sake of `clean-buffer-list': preserving the invariant
1545 ;; "how much time the user spent in Emacs without looking at this buffer". 1545 ;; "how much time the user spent in Emacs without looking at this buffer".
1546 (setq buffer-display-time 1546 (setq buffer-display-time
1547 (if buffer-display-time 1547 (time-since (if buffer-display-time
1548 (time-add buffer-display-time 1548 (time-subtract desktop-file-modtime
1549 (time-subtract nil desktop-file-modtime)) 1549 buffer-display-time)
1550 (current-time))) 1550 0)))
1551 (unless (< desktop-file-version 208) ; Don't misinterpret any old custom args 1551 (unless (< desktop-file-version 208) ; Don't misinterpret any old custom args
1552 (dolist (record compacted-vars) 1552 (dolist (record compacted-vars)
1553 (let* 1553 (let*
diff --git a/lisp/ecomplete.el b/lisp/ecomplete.el
index fb23ead63f6..d9f34ef0c00 100644
--- a/lisp/ecomplete.el
+++ b/lisp/ecomplete.el
@@ -210,7 +210,7 @@ matches."
210(defun ecomplete-decay-1 (elem) 210(defun ecomplete-decay-1 (elem)
211 ;; We subtract 5% from the item for each week it hasn't been used. 211 ;; We subtract 5% from the item for each week it hasn't been used.
212 (/ (car elem) 212 (/ (car elem)
213 (expt 1.05 (/ (- (float-time) (cadr elem)) 213 (expt 1.05 (/ (float-time (time-since (cadr elem)))
214 (* 7 24 60 60))))) 214 (* 7 24 60 60)))))
215 215
216;; `ecomplete-get-matches' uses substring matching, so also use the `substring' 216;; `ecomplete-get-matches' uses substring matching, so also use the `substring'
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 @@
38 `(let (,t1) 38 `(let (,t1)
39 (setq ,t1 (current-time)) 39 (setq ,t1 (current-time))
40 ,@forms 40 ,@forms
41 (float-time (time-subtract nil ,t1))))) 41 (float-time (time-since ,t1)))))
42 42
43;;;###autoload 43;;;###autoload
44(defmacro benchmark-run (&optional repetitions &rest forms) 44(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.")
1822 (force-mode-line-update) 1822 (force-mode-line-update)
1823 (redisplay t) 1823 (redisplay t)
1824 (setf (ert--stats-next-redisplay stats) 1824 (setf (ert--stats-next-redisplay stats)
1825 (+ (float-time) ert-test-run-redisplay-interval-secs))) 1825 (float-time (time-add nil ert-test-run-redisplay-interval-secs))))
1826 1826
1827(defun ert--results-update-stats-display-maybe (ewoc stats) 1827(defun ert--results-update-stats-display-maybe (ewoc stats)
1828 "Call `ert--results-update-stats-display' if not called recently. 1828 "Call `ert--results-update-stats-display' if not called recently.
1829 1829
1830EWOC and STATS are arguments for `ert--results-update-stats-display'." 1830EWOC and STATS are arguments for `ert--results-update-stats-display'."
1831 (when (>= (float-time) (ert--stats-next-redisplay stats)) 1831 (unless (time-less-p nil (ert--stats-next-redisplay stats))
1832 (ert--results-update-stats-display ewoc stats))) 1832 (ert--results-update-stats-display ewoc stats)))
1833 1833
1834(defun ert--tests-running-mode-line-indicator () 1834(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 @@
37 ;; Idle. 37 ;; Idle.
38 (if (aref timer 7) "*" " ") 38 (if (aref timer 7) "*" " ")
39 ;; Next time. 39 ;; Next time.
40 (let ((time (float-time (list (aref timer 1) 40 (let ((time (list (aref timer 1)
41 (aref timer 2) 41 (aref timer 2)
42 (aref timer 3))))) 42 (aref timer 3))))
43 (format "%.2f" 43 (format "%.2f"
44 (if (aref timer 7) 44 (float-time
45 time 45 (if (aref timer 7)
46 (- (float-time (list (aref timer 1) 46 time
47 (aref timer 2) 47 (time-subtract time nil)))))
48 (aref timer 3)))
49 (float-time)))))
50 ;; Repeat. 48 ;; Repeat.
51 (let ((repeat (aref timer 4))) 49 (let ((repeat (aref timer 4)))
52 (cond 50 (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 @@
74 74
75(defun timer-set-time (timer time &optional delta) 75(defun timer-set-time (timer time &optional delta)
76 "Set the trigger time of TIMER to TIME. 76 "Set the trigger time of TIMER to TIME.
77TIME must be in the internal format returned by, e.g., `current-time'. 77TIME must be a Lisp time value.
78If optional third argument DELTA is a positive number, make the timer 78If optional third argument DELTA is a positive number, make the timer
79fire repeatedly that many seconds apart." 79fire repeatedly that many seconds apart."
80 (setf (timer--time timer) time) 80 (setf (timer--time timer) time)
@@ -249,8 +249,8 @@ how many will really happen."
249(defun timer-until (timer time) 249(defun timer-until (timer time)
250 "Calculate number of seconds from when TIMER will run, until TIME. 250 "Calculate number of seconds from when TIMER will run, until TIME.
251TIMER is a timer, and stands for the time when its next repeat is scheduled. 251TIMER is a timer, and stands for the time when its next repeat is scheduled.
252TIME is a time-list." 252TIME is a Lisp time value."
253 (- (float-time time) (float-time (timer--time timer)))) 253 (float-time (time-subtract time (timer--time timer))))
254 254
255(defun timer-event-handler (timer) 255(defun timer-event-handler (timer)
256 "Call the handler for the timer TIMER. 256 "Call the handler for the timer TIMER.
@@ -281,7 +281,7 @@ This function is called, by name, directly by the C code."
281 ;; perhaps because Emacs was suspended for a long time, 281 ;; perhaps because Emacs was suspended for a long time,
282 ;; limit how many times things get repeated. 282 ;; limit how many times things get repeated.
283 (if (and (numberp timer-max-repeats) 283 (if (and (numberp timer-max-repeats)
284 (< 0 (timer-until timer nil))) 284 (time-less-p nil (timer--time timer)))
285 (let ((repeats (/ (timer-until timer nil) 285 (let ((repeats (/ (timer-until timer nil)
286 (timer--repeat-delay timer)))) 286 (timer--repeat-delay timer))))
287 (if (> repeats timer-max-repeats) 287 (if (> repeats timer-max-repeats)
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 2fd3d454bf3..2854cde19cc 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -844,10 +844,9 @@ Additionally, detect whether the IRC process has hung."
844 erc-server-last-received-time)) 844 erc-server-last-received-time))
845 (with-current-buffer buf 845 (with-current-buffer buf
846 (if (and erc-server-send-ping-timeout 846 (if (and erc-server-send-ping-timeout
847 (> 847 (time-less-p
848 (erc-time-diff (erc-current-time) 848 erc-server-send-ping-timeout
849 erc-server-last-received-time) 849 (time-since erc-server-last-received-time)))
850 erc-server-send-ping-timeout))
851 (progn 850 (progn
852 ;; if the process is hung, kill it 851 ;; if the process is hung, kill it
853 (setq erc-server-timed-out t) 852 (setq erc-server-timed-out t)
@@ -865,16 +864,15 @@ Additionally, detect whether the IRC process has hung."
865See `erc-server-flood-margin' for an explanation of the flood 864See `erc-server-flood-margin' for an explanation of the flood
866protection algorithm." 865protection algorithm."
867 (with-current-buffer buffer 866 (with-current-buffer buffer
868 (let ((now (erc-current-time))) 867 (let ((now (current-time)))
869 (when erc-server-flood-timer 868 (when erc-server-flood-timer
870 (erc-cancel-timer erc-server-flood-timer) 869 (erc-cancel-timer erc-server-flood-timer)
871 (setq erc-server-flood-timer nil)) 870 (setq erc-server-flood-timer nil))
872 (when (< erc-server-flood-last-message 871 (when (time-less-p erc-server-flood-last-message now)
873 now) 872 (setq erc-server-flood-last-message (erc-emacs-time-to-erc-time now)))
874 (setq erc-server-flood-last-message now))
875 (while (and erc-server-flood-queue 873 (while (and erc-server-flood-queue
876 (< erc-server-flood-last-message 874 (time-less-p erc-server-flood-last-message
877 (+ now erc-server-flood-margin))) 875 (time-add now erc-server-flood-margin)))
878 (let ((msg (caar erc-server-flood-queue)) 876 (let ((msg (caar erc-server-flood-queue))
879 (encoding (cdar erc-server-flood-queue))) 877 (encoding (cdar erc-server-flood-queue)))
880 (setq erc-server-flood-queue (cdr erc-server-flood-queue) 878 (setq erc-server-flood-queue (cdr erc-server-flood-queue)
@@ -1070,8 +1068,8 @@ Hands off to helper functions via `erc-call-hooks'."
1070 erc-server-prevent-duplicates) 1068 erc-server-prevent-duplicates)
1071 (let ((m (erc-response.unparsed parsed-response))) 1069 (let ((m (erc-response.unparsed parsed-response)))
1072 ;; duplicate suppression 1070 ;; duplicate suppression
1073 (if (< (or (gethash m erc-server-duplicates) 0) 1071 (if (time-less-p (or (gethash m erc-server-duplicates) 0)
1074 (- (erc-current-time) erc-server-duplicate-timeout)) 1072 (time-since erc-server-duplicate-timeout))
1075 (erc-call-hooks process parsed-response)) 1073 (erc-call-hooks process parsed-response))
1076 (puthash m (erc-current-time) erc-server-duplicates)) 1074 (puthash m (erc-current-time) erc-server-duplicates))
1077 ;; Hand off to the relevant handler. 1075 ;; Hand off to the relevant handler.
@@ -1447,7 +1445,7 @@ add things to `%s' instead."
1447 "Handle pong messages." nil 1445 "Handle pong messages." nil
1448 (let ((time (string-to-number (erc-response.contents parsed)))) 1446 (let ((time (string-to-number (erc-response.contents parsed))))
1449 (when (> time 0) 1447 (when (> time 0)
1450 (setq erc-server-lag (erc-time-diff time (erc-current-time))) 1448 (setq erc-server-lag (erc-time-diff time nil))
1451 (when erc-verbose-server-ping 1449 (when erc-verbose-server-ping
1452 (erc-display-message 1450 (erc-display-message
1453 parsed 'notice proc 'PONG 1451 parsed 'notice proc 'PONG
@@ -1730,7 +1728,7 @@ See `erc-display-server-message'." nil
1730 (cdr (erc-response.command-args parsed)))) 1728 (cdr (erc-response.command-args parsed))))
1731 (setq time (when on-since 1729 (setq time (when on-since
1732 (format-time-string erc-server-timestamp-format 1730 (format-time-string erc-server-timestamp-format
1733 (erc-string-to-emacs-time on-since)))) 1731 (string-to-number on-since))))
1734 (erc-update-user-nick nick nick nil nil nil 1732 (erc-update-user-nick nick nick nil nil nil
1735 (and time (format "on since %s" time))) 1733 (and time (format "on since %s" time)))
1736 (if time 1734 (if time
@@ -1802,7 +1800,7 @@ See `erc-display-server-message'." nil
1802(define-erc-response-handler (329) 1800(define-erc-response-handler (329)
1803 "Channel creation date." nil 1801 "Channel creation date." nil
1804 (let ((channel (cadr (erc-response.command-args parsed))) 1802 (let ((channel (cadr (erc-response.command-args parsed)))
1805 (time (erc-string-to-emacs-time 1803 (time (string-to-number
1806 (nth 2 (erc-response.command-args parsed))))) 1804 (nth 2 (erc-response.command-args parsed)))))
1807 (erc-display-message 1805 (erc-display-message
1808 parsed 'notice (erc-get-buffer channel proc) 1806 parsed 'notice (erc-get-buffer channel proc)
@@ -1844,7 +1842,7 @@ See `erc-display-server-message'." nil
1844 (pcase-let ((`(,channel ,nick ,time) 1842 (pcase-let ((`(,channel ,nick ,time)
1845 (cdr (erc-response.command-args parsed)))) 1843 (cdr (erc-response.command-args parsed))))
1846 (setq time (format-time-string erc-server-timestamp-format 1844 (setq time (format-time-string erc-server-timestamp-format
1847 (erc-string-to-emacs-time time))) 1845 (string-to-number time)))
1848 (erc-update-channel-topic channel 1846 (erc-update-channel-topic channel
1849 (format "\C-o (%s, %s)" nick time) 1847 (format "\C-o (%s, %s)" nick time)
1850 'append) 1848 'append)
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index 2849e25bf77..a6b7532e1f3 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -1024,7 +1024,7 @@ transfer is complete."
1024 ?s (number-to-string erc-dcc-byte-count) 1024 ?s (number-to-string erc-dcc-byte-count)
1025 ?t (format "%.0f" 1025 ?t (format "%.0f"
1026 (erc-time-diff (plist-get erc-dcc-entry-data :start-time) 1026 (erc-time-diff (plist-get erc-dcc-entry-data :start-time)
1027 (erc-current-time))))) 1027 nil))))
1028 (kill-buffer (process-buffer proc)) 1028 (kill-buffer (process-buffer proc))
1029 (delete-process proc)) 1029 (delete-process proc))
1030 1030
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el
index 6b526bdcf54..cc4b4a88f11 100644
--- a/lisp/erc/erc-match.el
+++ b/lisp/erc/erc-match.el
@@ -601,7 +601,7 @@ See `erc-log-match-format'."
601 'timestamp)))) 601 'timestamp))))
602 (away-time (erc-emacs-time-to-erc-time (erc-away-time)))) 602 (away-time (erc-emacs-time-to-erc-time (erc-away-time))))
603 (when (and away-time last-msg-time 603 (when (and away-time last-msg-time
604 (erc-time-gt last-msg-time away-time)) 604 (time-less-p away-time last-msg-time))
605 (erc-display-message 605 (erc-display-message
606 nil 'notice 'active 606 nil 'notice 'active
607 (format "You have logged messages waiting in \"%s\"." 607 (format "You have logged messages waiting in \"%s\"."
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index f42bd648725..e51e6056fb9 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -630,8 +630,8 @@ only consider active buffers visible.")
630 (if erc-track-when-inactive 630 (if erc-track-when-inactive
631 (when erc-buffer-activity; could be nil 631 (when erc-buffer-activity; could be nil
632 (and (erc-track-get-buffer-window buffer erc-track-visibility) 632 (and (erc-track-get-buffer-window buffer erc-track-visibility)
633 (<= (erc-time-diff erc-buffer-activity (erc-current-time)) 633 (not (time-less-p erc-buffer-activity-timeout
634 erc-buffer-activity-timeout))) 634 (erc-time-diff erc-buffer-activity nil)))))
635 (erc-track-get-buffer-window buffer erc-track-visibility))) 635 (erc-track-get-buffer-window buffer erc-track-visibility)))
636 636
637;;; Tracking the channel modifications 637;;; Tracking the channel modifications
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 697e26b7944..101a5a05bf6 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -2565,8 +2565,8 @@ consumption for long-lived IRC or Emacs sessions."
2565 (maphash 2565 (maphash
2566 (lambda (nick last-PRIVMSG-time) 2566 (lambda (nick last-PRIVMSG-time)
2567 (when 2567 (when
2568 (> (float-time (time-subtract nil last-PRIVMSG-time)) 2568 (time-less-p erc-lurker-threshold-time
2569 erc-lurker-threshold-time) 2569 (time-since last-PRIVMSG-time))
2570 (remhash nick hash))) 2570 (remhash nick hash)))
2571 hash) 2571 hash)
2572 (if (zerop (hash-table-count hash)) 2572 (if (zerop (hash-table-count hash))
@@ -2631,9 +2631,8 @@ server within `erc-lurker-threshold-time'. See also
2631 (gethash (erc-lurker-maybe-trim nick) 2631 (gethash (erc-lurker-maybe-trim nick)
2632 (gethash server erc-lurker-state (make-hash-table))))) 2632 (gethash server erc-lurker-state (make-hash-table)))))
2633 (or (null last-PRIVMSG-time) 2633 (or (null last-PRIVMSG-time)
2634 (> (float-time 2634 (time-less-p erc-lurker-threshold-time
2635 (time-subtract nil last-PRIVMSG-time)) 2635 (time-since last-PRIVMSG-time)))))
2636 erc-lurker-threshold-time))))
2637 2636
2638(defcustom erc-common-server-suffixes 2637(defcustom erc-common-server-suffixes
2639 '(("openprojects.net\\'" . "OPN") 2638 '(("openprojects.net\\'" . "OPN")
@@ -3412,7 +3411,7 @@ Otherwise leave the channel indicated by LINE."
3412 3411
3413(defun erc-cmd-PING (recipient) 3412(defun erc-cmd-PING (recipient)
3414 "Ping RECIPIENT." 3413 "Ping RECIPIENT."
3415 (let ((time (format "%f" (erc-current-time)))) 3414 (let ((time (format-time-string "%s.%6N")))
3416 (erc-log (format "cmd: PING: %s" time)) 3415 (erc-log (format "cmd: PING: %s" time))
3417 (erc-cmd-CTCP recipient "PING" time))) 3416 (erc-cmd-CTCP recipient "PING" time)))
3418 3417
@@ -4640,7 +4639,7 @@ See also `erc-display-message'."
4640 (user-full-name) 4639 (user-full-name)
4641 (user-login-name) 4640 (user-login-name)
4642 (system-name)))) 4641 (system-name))))
4643 (ns (erc-time-diff erc-server-last-sent-time (erc-current-time)))) 4642 (ns (erc-time-diff erc-server-last-sent-time nil)))
4644 (when (> ns 0) 4643 (when (> ns 0)
4645 (setq s (concat s " Idle for " (erc-sec-to-time ns)))) 4644 (setq s (concat s " Idle for " (erc-sec-to-time ns))))
4646 (erc-send-ctcp-notice nick s))) 4645 (erc-send-ctcp-notice nick s)))
@@ -4729,8 +4728,7 @@ See also `erc-display-message'."
4729 nil 4728 nil
4730 (let ((time (match-string 1 msg))) 4729 (let ((time (match-string 1 msg)))
4731 (condition-case nil 4730 (condition-case nil
4732 (let ((delta (erc-time-diff (string-to-number time) 4731 (let ((delta (erc-time-diff (string-to-number time) nil)))
4733 (erc-current-time))))
4734 (erc-display-message 4732 (erc-display-message
4735 nil 'notice 'active 4733 nil 'notice 'active
4736 'CTCP-PING ?n nick 4734 'CTCP-PING ?n nick
@@ -4788,10 +4786,7 @@ If non-nil, return from being away."
4788 (erc-default-target) 4786 (erc-default-target)
4789 (if away-time 4787 (if away-time
4790 (format "is back (gone for %s)" 4788 (format "is back (gone for %s)"
4791 (erc-sec-to-time 4789 (erc-sec-to-time (erc-time-diff away-time nil)))
4792 (erc-time-diff
4793 (erc-emacs-time-to-erc-time away-time)
4794 (erc-current-time))))
4795 "is back"))))))))) 4790 "is back")))))))))
4796 (erc-update-mode-line))) 4791 (erc-update-mode-line)))
4797 4792
@@ -5383,10 +5378,10 @@ submitted line to be intentional."
5383(defun erc-send-current-line () 5378(defun erc-send-current-line ()
5384 "Parse current line and send it to IRC." 5379 "Parse current line and send it to IRC."
5385 (interactive) 5380 (interactive)
5386 (let ((now (float-time))) 5381 (let ((now (current-time)))
5387 (if (or (not erc-accidental-paste-threshold-seconds) 5382 (if (or (not erc-accidental-paste-threshold-seconds)
5388 (< erc-accidental-paste-threshold-seconds 5383 (time-less-p erc-accidental-paste-threshold-seconds
5389 (- now erc-last-input-time))) 5384 (time-subtract now erc-last-input-time)))
5390 (save-restriction 5385 (save-restriction
5391 (widen) 5386 (widen)
5392 (if (< (point) (erc-beg-of-input-line)) 5387 (if (< (point) (erc-beg-of-input-line))
@@ -6036,22 +6031,20 @@ non-nil value is found.
6036 6031
6037;; time routines 6032;; time routines
6038 6033
6039(defun erc-string-to-emacs-time (string) 6034(define-obsolete-function-alias 'erc-string-to-emacs-time 'string-to-number
6040 "Convert the long number represented by STRING into an Emacs timestamp." 6035 "27.1")
6041 (let* ((n (string-to-number (concat string ".0"))))
6042 (list (truncate (/ n 65536))
6043 (truncate (mod n 65536)))))
6044 6036
6045(defalias 'erc-emacs-time-to-erc-time 'float-time) 6037(defalias 'erc-emacs-time-to-erc-time 'float-time)
6046(defalias 'erc-current-time 'float-time) 6038(defalias 'erc-current-time 'float-time)
6047 6039
6048(defun erc-time-diff (t1 t2) 6040(defun erc-time-diff (t1 t2)
6049 "Return the time difference in seconds between T1 and T2." 6041 "Return the absolute value of the difference in seconds between T1 and T2."
6050 (abs (- t2 t1))) 6042 (abs (float-time (time-subtract t1 t2))))
6051 6043
6052(defun erc-time-gt (t1 t2) 6044(defun erc-time-gt (t1 t2)
6053 "Check whether T1 > T2." 6045 "Check whether T1 > T2."
6054 (> t1 t2)) 6046 (declare (obsolete time-less-p "27.1"))
6047 (time-less-p t2 t1))
6055 6048
6056(defun erc-sec-to-time (ns) 6049(defun erc-sec-to-time (ns)
6057 "Convert NS to a time string HH:MM.SS." 6050 "Convert NS to a time string HH:MM.SS."
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el
index 1cbd2367f53..dd3351b14d3 100644
--- a/lisp/eshell/em-pred.el
+++ b/lisp/eshell/em-pred.el
@@ -421,9 +421,8 @@ resultant list of strings."
421 (forward-char)) 421 (forward-char))
422 (if (looking-at "[0-9]+") 422 (if (looking-at "[0-9]+")
423 (progn 423 (progn
424 (setq when (- (float-time) 424 (setq when (time-since (* (string-to-number (match-string 0))
425 (* (string-to-number (match-string 0)) 425 quantum)))
426 quantum)))
427 (goto-char (match-end 0))) 426 (goto-char (match-end 0)))
428 (setq open (char-after)) 427 (setq open (char-after))
429 (if (setq close (memq open '(?\( ?\[ ?\< ?\{))) 428 (if (setq close (memq open '(?\( ?\[ ?\< ?\{)))
@@ -438,17 +437,17 @@ resultant list of strings."
438 (attrs (file-attributes file))) 437 (attrs (file-attributes file)))
439 (unless attrs 438 (unless attrs
440 (error "Cannot stat file `%s'" file)) 439 (error "Cannot stat file `%s'" file))
441 (setq when (float-time (nth attr-index attrs)))) 440 (setq when (nth attr-index attrs)))
442 (goto-char (1+ end))) 441 (goto-char (1+ end)))
443 `(lambda (file) 442 `(lambda (file)
444 (let ((attrs (file-attributes file))) 443 (let ((attrs (file-attributes file)))
445 (if attrs 444 (if attrs
446 (,(if (eq qual ?-) 445 (,(if (eq qual ?-)
447 '< 446 'time-less-p
448 (if (eq qual ?+) 447 (if (eq qual ?+)
449 '> 448 '(lambda (a b) (time-less-p b a))
450 '=)) ,when (float-time 449 'time-equal-p))
451 (nth ,attr-index attrs)))))))) 450 ,when (nth ,attr-index attrs)))))))
452 451
453(defun eshell-pred-file-type (type) 452(defun eshell-pred-file-type (type)
454 "Return a test which tests that the file is of a certain TYPE. 453 "Return a test which tests that the file is of a certain TYPE.
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index fca50d70ae7..e4c4265d702 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -943,7 +943,8 @@ Summarize disk usage of each FILE, recursively for directories.")
943(defvar eshell-time-start nil) 943(defvar eshell-time-start nil)
944 944
945(defun eshell-show-elapsed-time () 945(defun eshell-show-elapsed-time ()
946 (let ((elapsed (format "%.3f secs\n" (- (float-time) eshell-time-start)))) 946 (let ((elapsed (format "%.3f secs\n"
947 (float-time (time-since eshell-time-start)))))
947 (set-text-properties 0 (length elapsed) '(face bold) elapsed) 948 (set-text-properties 0 (length elapsed) '(face bold) elapsed)
948 (eshell-interactive-print elapsed)) 949 (eshell-interactive-print elapsed))
949 (remove-hook 'eshell-post-command-hook 'eshell-show-elapsed-time t)) 950 (remove-hook 'eshell-post-command-hook 'eshell-show-elapsed-time t))
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index 0ea156118c6..06f7be3da7d 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -3610,7 +3610,7 @@ possible values."
3610(defun article-lapsed-string (time &optional max-segments) 3610(defun article-lapsed-string (time &optional max-segments)
3611 ;; If the date is seriously mangled, the timezone functions are 3611 ;; If the date is seriously mangled, the timezone functions are
3612 ;; liable to bug out, so we ignore all errors. 3612 ;; liable to bug out, so we ignore all errors.
3613 (let* ((real-time (time-subtract nil time)) 3613 (let* ((real-time (time-since time))
3614 (real-sec (float-time real-time)) 3614 (real-sec (float-time real-time))
3615 (sec (abs real-sec)) 3615 (sec (abs real-sec))
3616 (segments 0) 3616 (segments 0)
diff --git a/lisp/gnus/gnus-demon.el b/lisp/gnus/gnus-demon.el
index b9cb8eb71ce..6c5e0b7f5d0 100644
--- a/lisp/gnus/gnus-demon.el
+++ b/lisp/gnus/gnus-demon.el
@@ -93,7 +93,7 @@ Emacs has been idle for IDLE `gnus-demon-timestep's."
93 93
94(defun gnus-demon-idle-since () 94(defun gnus-demon-idle-since ()
95 "Return the number of seconds since when Emacs is idle." 95 "Return the number of seconds since when Emacs is idle."
96 (float-time (or (current-idle-time) '(0 0 0)))) 96 (float-time (or (current-idle-time) 0)))
97 97
98(defun gnus-demon-run-callback (func &optional idle time special) 98(defun gnus-demon-run-callback (func &optional idle time special)
99 "Run FUNC if Emacs has been idle for longer than IDLE seconds. 99 "Run FUNC if Emacs has been idle for longer than IDLE seconds.
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index cf8423b2db1..9f579bbd96c 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -4590,7 +4590,7 @@ or `gnus-group-catchup-group-hook'."
4590 ;; FIXME: This should return a Lisp integer, not a Lisp float, 4590 ;; FIXME: This should return a Lisp integer, not a Lisp float,
4591 ;; since it is always an integer. 4591 ;; since it is always an integer.
4592 (let* ((time (or (gnus-group-timestamp group) 0)) 4592 (let* ((time (or (gnus-group-timestamp group) 0))
4593 (delta (time-subtract nil time))) 4593 (delta (time-since time)))
4594 (float-time delta))) 4594 (float-time delta)))
4595 4595
4596(defun gnus-group-timestamp-string (group) 4596(defun gnus-group-timestamp-string (group)
diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el
index a9d15f92262..062dd1b2917 100644
--- a/lisp/gnus/gnus-icalendar.el
+++ b/lisp/gnus/gnus-icalendar.el
@@ -413,13 +413,12 @@ Return nil for non-recurring EVENT."
413 (end-time (format-time-string "%H:%M" end)) 413 (end-time (format-time-string "%H:%M" end))
414 (end-at-midnight (string= end-time "00:00")) 414 (end-at-midnight (string= end-time "00:00"))
415 (start-end-date-diff 415 (start-end-date-diff
416 (/ (float-time (time-subtract 416 (time-to-number-of-days (time-subtract
417 (org-time-string-to-time end-date) 417 (org-time-string-to-time end-date)
418 (org-time-string-to-time start-date))) 418 (org-time-string-to-time start-date))))
419 86400))
420 (org-repeat (gnus-icalendar-event:org-repeat event)) 419 (org-repeat (gnus-icalendar-event:org-repeat event))
421 (repeat (if org-repeat (concat " " org-repeat) "")) 420 (repeat (if org-repeat (concat " " org-repeat) ""))
422 (time-1-day '(0 86400))) 421 (time-1-day 86400))
423 422
424 ;; NOTE: special care is needed with appointments ending at midnight 423 ;; NOTE: special care is needed with appointments ending at midnight
425 ;; (typically all-day events): the end time has to be changed to 23:59 to 424 ;; (typically all-day events): the end time has to be changed to 23:59 to
diff --git a/lisp/gnus/gnus-int.el b/lisp/gnus/gnus-int.el
index 477eb9c464a..e23e53b1ef5 100644
--- a/lisp/gnus/gnus-int.el
+++ b/lisp/gnus/gnus-int.el
@@ -257,7 +257,8 @@ If it is down, start it up (again)."
257 (insert (format-time-string "%H:%M:%S") 257 (insert (format-time-string "%H:%M:%S")
258 (format " %.2fs %s %S\n" 258 (format " %.2fs %s %S\n"
259 (if (numberp gnus-backend-trace-elapsed) 259 (if (numberp gnus-backend-trace-elapsed)
260 (- (float-time) gnus-backend-trace-elapsed) 260 (float-time
261 (time-since gnus-backend-trace-elapsed))
261 0) 262 0)
262 type form)) 263 type form))
263 (setq gnus-backend-trace-elapsed (float-time))))) 264 (setq gnus-backend-trace-elapsed (float-time)))))
diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index f5fd4f300a8..6114fb5f4f5 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -1501,7 +1501,7 @@ If FORMAT, also format the current score file."
1501 (when (and gnus-summary-default-score 1501 (when (and gnus-summary-default-score
1502 scores) 1502 scores)
1503 (let* ((entries gnus-header-index) 1503 (let* ((entries gnus-header-index)
1504 (now (time-to-days (current-time))) 1504 (now (time-to-days nil))
1505 (expire (and gnus-score-expiry-days 1505 (expire (and gnus-score-expiry-days
1506 (- now gnus-score-expiry-days))) 1506 (- now gnus-score-expiry-days)))
1507 (headers gnus-newsgroup-headers) 1507 (headers gnus-newsgroup-headers)
@@ -2380,7 +2380,7 @@ score in `gnus-newsgroup-scored' by SCORE."
2380 (memq 'word gnus-newsgroup-adaptive)) 2380 (memq 'word gnus-newsgroup-adaptive))
2381 (with-temp-buffer 2381 (with-temp-buffer
2382 (let* ((hashtb (gnus-make-hashtable 1000)) 2382 (let* ((hashtb (gnus-make-hashtable 1000))
2383 (date (time-to-days (current-time))) 2383 (date (time-to-days nil))
2384 (data gnus-newsgroup-data) 2384 (data gnus-newsgroup-data)
2385 word d score val) 2385 word d score val)
2386 (with-syntax-table gnus-adaptive-word-syntax-table 2386 (with-syntax-table gnus-adaptive-word-syntax-table
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 3a5886a8636..efb3e4f1a66 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -3855,20 +3855,20 @@ respectively."
3855Returns \" ? \" if there's bad input or if another error occurs. 3855Returns \" ? \" if there's bad input or if another error occurs.
3856Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"." 3856Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"."
3857 (condition-case () 3857 (condition-case ()
3858 (let* ((messy-date (float-time (gnus-date-get-time messy-date))) 3858 (let* ((messy-date (gnus-date-get-time messy-date))
3859 (now (float-time)) 3859 (now (current-time))
3860 ;;If we don't find something suitable we'll use this one 3860 ;;If we don't find something suitable we'll use this one
3861 (my-format "%b %d '%y")) 3861 (my-format "%b %d '%y"))
3862 (let* ((difference (- now messy-date)) 3862 (let* ((difference (time-subtract now messy-date))
3863 (templist gnus-user-date-format-alist) 3863 (templist gnus-user-date-format-alist)
3864 (top (eval (caar templist)))) 3864 (top (eval (caar templist))))
3865 (while (if (numberp top) (< top difference) (not top)) 3865 (while (if (numberp top) (time-less-p top difference) (not top))
3866 (progn 3866 (progn
3867 (setq templist (cdr templist)) 3867 (setq templist (cdr templist))
3868 (setq top (eval (caar templist))))) 3868 (setq top (eval (caar templist)))))
3869 (if (stringp (cdr (car templist))) 3869 (if (stringp (cdr (car templist)))
3870 (setq my-format (cdr (car templist))))) 3870 (setq my-format (cdr (car templist)))))
3871 (format-time-string (eval my-format) (encode-time messy-date))) 3871 (format-time-string (eval my-format) messy-date))
3872 (error " ? "))) 3872 (error " ? ")))
3873 3873
3874(defun gnus-summary-set-local-parameters (group) 3874(defun gnus-summary-set-local-parameters (group)
@@ -5093,8 +5093,8 @@ Unscored articles will be counted as having a score of zero."
5093 "Return the highest article date in THREAD." 5093 "Return the highest article date in THREAD."
5094 (apply 'max 5094 (apply 'max
5095 (mapcar (lambda (header) (float-time 5095 (mapcar (lambda (header) (float-time
5096 (gnus-date-get-time 5096 (gnus-date-get-time
5097 (mail-header-date header)))) 5097 (mail-header-date header))))
5098 (flatten-tree thread)))) 5098 (flatten-tree thread))))
5099 5099
5100(defun gnus-thread-total-score-1 (root) 5100(defun gnus-thread-total-score-1 (root)
diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el
index 5a389fae137..7514e64e7c2 100644
--- a/lisp/gnus/mail-source.el
+++ b/lisp/gnus/mail-source.el
@@ -647,9 +647,9 @@ Deleting old (> %s day(s)) incoming mail file `%s'." diff bfile)
647 ;; Don't check for old incoming files more than once per day to 647 ;; Don't check for old incoming files more than once per day to
648 ;; save a lot of file accesses. 648 ;; save a lot of file accesses.
649 (when (or (null mail-source-incoming-last-checked-time) 649 (when (or (null mail-source-incoming-last-checked-time)
650 (> (float-time 650 (time-less-p
651 (time-since mail-source-incoming-last-checked-time)) 651 (* 24 60 60)
652 (* 24 60 60))) 652 (time-since mail-source-incoming-last-checked-time)))
653 (setq mail-source-incoming-last-checked-time (current-time)) 653 (setq mail-source-incoming-last-checked-time (current-time))
654 (mail-source-delete-old-incoming 654 (mail-source-delete-old-incoming
655 mail-source-delete-incoming 655 mail-source-delete-incoming
diff --git a/lisp/gnus/nneething.el b/lisp/gnus/nneething.el
index 885d6f2afcf..f64007aaf79 100644
--- a/lisp/gnus/nneething.el
+++ b/lisp/gnus/nneething.el
@@ -319,7 +319,7 @@ included.")
319 "Subject: " (file-name-nondirectory file) (or extra-msg "") "\n" 319 "Subject: " (file-name-nondirectory file) (or extra-msg "") "\n"
320 "Message-ID: <nneething-" (nneething-encode-file-name file) 320 "Message-ID: <nneething-" (nneething-encode-file-name file)
321 "@" (system-name) ">\n" 321 "@" (system-name) ">\n"
322 (if (zerop (float-time (file-attribute-modification-time atts))) "" 322 (if (time-equal-p 0 (file-attribute-modification-time atts)) ""
323 (concat "Date: " 323 (concat "Date: "
324 (current-time-string (file-attribute-modification-time atts)) 324 (current-time-string (file-attribute-modification-time atts))
325 "\n")) 325 "\n"))
diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el
index 7c8673ee1c5..090b8420842 100644
--- a/lisp/gnus/nnheader.el
+++ b/lisp/gnus/nnheader.el
@@ -1075,7 +1075,7 @@ See `find-file-noselect' for the arguments."
1075(defvar nnheader-last-message-time '(0 0)) 1075(defvar nnheader-last-message-time '(0 0))
1076(defun nnheader-message-maybe (&rest args) 1076(defun nnheader-message-maybe (&rest args)
1077 (let ((now (current-time))) 1077 (let ((now (current-time)))
1078 (when (> (float-time (time-subtract now nnheader-last-message-time)) 1) 1078 (when (time-less-p 1 (time-subtract now nnheader-last-message-time))
1079 (setq nnheader-last-message-time now) 1079 (setq nnheader-last-message-time now)
1080 (apply 'nnheader-message args)))) 1080 (apply 'nnheader-message args))))
1081 1081
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 9646bb51d08..ac1d28644f7 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -386,12 +386,12 @@ textual parts.")
386 (with-current-buffer buffer 386 (with-current-buffer buffer
387 (when (and nnimap-object 387 (when (and nnimap-object
388 (nnimap-last-command-time nnimap-object) 388 (nnimap-last-command-time nnimap-object)
389 (> (float-time 389 (time-less-p
390 (time-subtract 390 ;; More than five minutes since the last command.
391 now 391 (* 5 60)
392 (nnimap-last-command-time nnimap-object))) 392 (time-subtract
393 ;; More than five minutes since the last command. 393 now
394 (* 5 60))) 394 (nnimap-last-command-time nnimap-object))))
395 (ignore-errors ;E.g. "buffer foo has no process". 395 (ignore-errors ;E.g. "buffer foo has no process".
396 (nnimap-send-command "NOOP")))))))) 396 (nnimap-send-command "NOOP"))))))))
397 397
diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el
index c2e84c47035..f6d75252930 100644
--- a/lisp/gnus/nnmail.el
+++ b/lisp/gnus/nnmail.el
@@ -1882,7 +1882,7 @@ If TIME is nil, then return the cutoff time for oldness instead."
1882 (setq days (days-to-time days)) 1882 (setq days (days-to-time days))
1883 ;; Compare the time with the current time. 1883 ;; Compare the time with the current time.
1884 (if (null time) 1884 (if (null time)
1885 (time-subtract nil days) 1885 (time-since days)
1886 (ignore-errors (time-less-p days (time-since time))))))))) 1886 (ignore-errors (time-less-p days (time-since time)))))))))
1887 1887
1888(declare-function gnus-group-mark-article-read "gnus-group" (group article)) 1888(declare-function gnus-group-mark-article-read "gnus-group" (group article))
diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el
index d7117a1ce20..5fabeac7e39 100644
--- a/lisp/gnus/nnmaildir.el
+++ b/lisp/gnus/nnmaildir.el
@@ -764,7 +764,7 @@ This variable is set by `nnmaildir-request-article'.")
764 764
765(defun nnmaildir--scan (gname scan-msgs groups _method srv-dir srv-ls) 765(defun nnmaildir--scan (gname scan-msgs groups _method srv-dir srv-ls)
766 (catch 'return 766 (catch 'return
767 (let ((36h-ago (- (float-time) 129600)) 767 (let ((36h-ago (time-since 129600))
768 absdir nndir tdir ndir cdir nattr cattr isnew pgname read-only ls 768 absdir nndir tdir ndir cdir nattr cattr isnew pgname read-only ls
769 files num dir flist group x) 769 files num dir flist group x)
770 (setq absdir (nnmaildir--srvgrp-dir srv-dir gname) 770 (setq absdir (nnmaildir--srvgrp-dir srv-dir gname)
@@ -1577,7 +1577,7 @@ This variable is set by `nnmaildir-request-article'.")
1577 (when no-force 1577 (when no-force
1578 (unless (integerp time) ;; handle 'never 1578 (unless (integerp time) ;; handle 'never
1579 (throw 'return (gnus-uncompress-range ranges))) 1579 (throw 'return (gnus-uncompress-range ranges)))
1580 (setq boundary (time-subtract nil time))) 1580 (setq boundary (time-since time)))
1581 (setq dir (nnmaildir--srv-dir nnmaildir--cur-server) 1581 (setq dir (nnmaildir--srv-dir nnmaildir--cur-server)
1582 dir (nnmaildir--srvgrp-dir dir gname) 1582 dir (nnmaildir--srvgrp-dir dir gname)
1583 dir (nnmaildir--cur dir) 1583 dir (nnmaildir--cur dir)
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index fcda565e5d3..1b69574a392 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1948,11 +1948,10 @@ Otherwise buffers whose name matches an element of
1948 (ibuffer-mark-on-buffer 1948 (ibuffer-mark-on-buffer
1949 #'(lambda (buf) 1949 #'(lambda (buf)
1950 (with-current-buffer buf 1950 (with-current-buffer buf
1951 ;; hacked from midnight.el
1952 (when buffer-display-time 1951 (when buffer-display-time
1953 (let* ((now (float-time)) 1952 (time-less-p
1954 (then (float-time buffer-display-time))) 1953 (* 60 60 ibuffer-old-time)
1955 (> (- now then) (* 60 60 ibuffer-old-time)))))))) 1954 (time-since buffer-display-time)))))))
1956 1955
1957;;;###autoload 1956;;;###autoload
1958(defun ibuffer-mark-special-buffers () 1957(defun ibuffer-mark-special-buffers ()
diff --git a/lisp/image.el b/lisp/image.el
index c66440c86e7..6da3a0b6cd0 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -804,19 +804,22 @@ If the image has a non-nil :speed property, it acts as a multiplier
804for the animation speed. A negative value means to animate in reverse." 804for the animation speed. A negative value means to animate in reverse."
805 (when (and (buffer-live-p (plist-get (cdr image) :animate-buffer)) 805 (when (and (buffer-live-p (plist-get (cdr image) :animate-buffer))
806 ;; Delayed more than two seconds more than expected. 806 ;; Delayed more than two seconds more than expected.
807 (or (<= (- (float-time) target-time) 2) 807 (or (time-less-p (time-since target-time) 2)
808 (progn 808 (progn
809 (message "Stopping animation; animation possibly too big") 809 (message "Stopping animation; animation possibly too big")
810 nil))) 810 nil)))
811 (image-show-frame image n t) 811 (image-show-frame image n t)
812 (let* ((speed (image-animate-get-speed image)) 812 (let* ((speed (image-animate-get-speed image))
813 (time (float-time)) 813 (time (current-time))
814 (animation (image-multi-frame-p image)) 814 (animation (image-multi-frame-p image))
815 (time-to-load-image (time-since time))
816 (stated-delay-time (/ (or (cdr animation)
817 image-default-frame-delay)
818 (float (abs speed))))
815 ;; Subtract off the time we took to load the image from the 819 ;; Subtract off the time we took to load the image from the
816 ;; stated delay time. 820 ;; stated delay time.
817 (delay (max (+ (* (or (cdr animation) image-default-frame-delay) 821 (delay (max (float-time (time-subtract stated-delay-time
818 (/ 1.0 (abs speed))) 822 time-to-load-image))
819 time (- (float-time)))
820 image-minimum-frame-delay)) 823 image-minimum-frame-delay))
821 done) 824 done)
822 (setq n (if (< speed 0) 825 (setq n (if (< speed 0)
diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el
index ff178241a90..a90d9c46578 100644
--- a/lisp/mail/feedmail.el
+++ b/lisp/mail/feedmail.el
@@ -2369,7 +2369,7 @@ mapped to mostly alphanumerics for safety."
2369 2369
2370(defun feedmail-rfc822-date (arg-time) 2370(defun feedmail-rfc822-date (arg-time)
2371 (feedmail-say-debug ">in-> feedmail-rfc822-date %s" arg-time) 2371 (feedmail-say-debug ">in-> feedmail-rfc822-date %s" arg-time)
2372 (let ((time (if arg-time arg-time (current-time))) 2372 (let ((time (or arg-time (current-time)))
2373 (system-time-locale "C")) 2373 (system-time-locale "C"))
2374 (concat 2374 (concat
2375 (format-time-string "%a, %e %b %Y %T " time) 2375 (format-time-string "%a, %e %b %Y %T " time)
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 698c2ce9909..835eaa32c61 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -98,7 +98,7 @@ point at the click position."
98 98
99(defun mouse--down-1-maybe-follows-link (&optional _prompt) 99(defun mouse--down-1-maybe-follows-link (&optional _prompt)
100 (when mouse-1-click-follows-link 100 (when mouse-1-click-follows-link
101 (setq mouse--last-down (cons (car-safe last-input-event) (float-time)))) 101 (setq mouse--last-down (cons (car-safe last-input-event) (current-time))))
102 nil) 102 nil)
103 103
104(defun mouse--click-1-maybe-follows-link (&optional _prompt) 104(defun mouse--click-1-maybe-follows-link (&optional _prompt)
@@ -110,8 +110,10 @@ Expects to be bound to `(double-)mouse-1' in `key-translation-map'."
110 ('double (eq 'double-mouse-1 (car-safe last-input-event))) 110 ('double (eq 'double-mouse-1 (car-safe last-input-event)))
111 (_ (and (eq 'mouse-1 (car-safe last-input-event)) 111 (_ (and (eq 'mouse-1 (car-safe last-input-event))
112 (or (not (numberp mouse-1-click-follows-link)) 112 (or (not (numberp mouse-1-click-follows-link))
113 (funcall (if (< mouse-1-click-follows-link 0) #'> #'<) 113 (funcall (if (< mouse-1-click-follows-link 0)
114 (- (float-time) (cdr mouse--last-down)) 114 (lambda (a b) (time-less-p b a))
115 #'time-less-p)
116 (time-since (cdr mouse--last-down))
115 (/ (abs mouse-1-click-follows-link) 1000.0)))))) 117 (/ (abs mouse-1-click-follows-link) 1000.0))))))
116 (eq (car mouse--last-down) 118 (eq (car mouse--last-down)
117 (event-convert-list (list 'down (car-safe last-input-event)))) 119 (event-convert-list (list 'down (car-safe last-input-event))))
diff --git a/lisp/mpc.el b/lisp/mpc.el
index 4a349871a56..8e557ed2b35 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -2555,7 +2555,6 @@ If stopped, start playback."
2555(defvar mpc--faster-toggle-forward nil) 2555(defvar mpc--faster-toggle-forward nil)
2556(defvar mpc--faster-acceleration 0.5) 2556(defvar mpc--faster-acceleration 0.5)
2557(defun mpc--faster-toggle (speedup step) 2557(defun mpc--faster-toggle (speedup step)
2558 (setq speedup (float speedup))
2559 (if mpc--faster-toggle-timer 2558 (if mpc--faster-toggle-timer
2560 (mpc--faster-stop) 2559 (mpc--faster-stop)
2561 (mpc-status-refresh) (mpc-proc-sync) 2560 (mpc-status-refresh) (mpc-proc-sync)
@@ -2582,7 +2581,7 @@ If stopped, start playback."
2582 (setq songtime (string-to-number 2581 (setq songtime (string-to-number
2583 (cdr (assq 'time mpc-status)))) 2582 (cdr (assq 'time mpc-status))))
2584 (setq songduration (mpc--songduration)) 2583 (setq songduration (mpc--songduration))
2585 (setq oldtime (float-time))) 2584 (setq oldtime (current-time)))
2586 ((and (>= songtime songduration) mpc--faster-toggle-forward) 2585 ((and (>= songtime songduration) mpc--faster-toggle-forward)
2587 ;; Skip to the beginning of the next song. 2586 ;; Skip to the beginning of the next song.
2588 (if (not (equal (cdr (assq 'state mpc-status)) "play")) 2587 (if (not (equal (cdr (assq 'state mpc-status)) "play"))
@@ -2601,14 +2600,16 @@ If stopped, start playback."
2601 (lambda () 2600 (lambda ()
2602 (setq songid (cdr (assq 'songid mpc-status))) 2601 (setq songid (cdr (assq 'songid mpc-status)))
2603 (setq songtime (setq songduration (mpc--songduration))) 2602 (setq songtime (setq songduration (mpc--songduration)))
2604 (setq oldtime (float-time)) 2603 (setq oldtime (current-time))
2605 (mpc-proc-cmd (list "seekid" songid songtime))))))) 2604 (mpc-proc-cmd (list "seekid" songid songtime)))))))
2606 (t 2605 (t
2607 (setq speedup (+ speedup mpc--faster-acceleration)) 2606 (setq speedup (+ speedup mpc--faster-acceleration))
2608 (let ((newstep 2607 (let ((newstep
2609 (truncate (* speedup (- (float-time) oldtime))))) 2608 (truncate
2609 (* speedup
2610 (float-time (time-since oldtime))))))
2610 (if (<= newstep 1) (setq newstep 1)) 2611 (if (<= newstep 1) (setq newstep 1))
2611 (setq oldtime (+ oldtime (/ newstep speedup))) 2612 (setq oldtime (time-add oldtime (/ newstep speedup)))
2612 (if (not mpc--faster-toggle-forward) 2613 (if (not mpc--faster-toggle-forward)
2613 (setq newstep (- newstep))) 2614 (setq newstep (- newstep)))
2614 (setq songtime (min songduration (+ songtime newstep))) 2615 (setq songtime (min songduration (+ songtime newstep)))
diff --git a/lisp/net/imap.el b/lisp/net/imap.el
index bc0e2e609aa..9f43c57ffd3 100644
--- a/lisp/net/imap.el
+++ b/lisp/net/imap.el
@@ -1918,11 +1918,7 @@ on failure."
1918 (unless (< len 10) 1918 (unless (< len 10)
1919 (setq imap-have-messaged t) 1919 (setq imap-have-messaged t)
1920 (message "imap read: %dk" len)) 1920 (message "imap read: %dk" len))
1921 (accept-process-output imap-process 1921 (accept-process-output imap-process imap-read-timeout)))
1922 (truncate imap-read-timeout)
1923 (truncate (* (- imap-read-timeout
1924 (truncate imap-read-timeout))
1925 1000)))))
1926 ;; A process can die _before_ we have processed everything it 1922 ;; A process can die _before_ we have processed everything it
1927 ;; has to say. Moreover, this can happen in between the call to 1923 ;; has to say. Moreover, this can happen in between the call to
1928 ;; accept-process-output and the call to process-status in an 1924 ;; accept-process-output and the call to process-status in an
diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el
index 9ff4649fee0..9925a045754 100644
--- a/lisp/net/newst-backend.el
+++ b/lisp/net/newst-backend.el
@@ -1802,7 +1802,7 @@ download it from URL first."
1802 (time-less-p nil 1802 (time-less-p nil
1803 (time-add (file-attribute-modification-time 1803 (time-add (file-attribute-modification-time
1804 (file-attributes image-name)) 1804 (file-attributes image-name))
1805 (encode-time 86400)))) 1805 86400)))
1806 (newsticker--debug-msg "%s: Getting image for %s skipped" 1806 (newsticker--debug-msg "%s: Getting image for %s skipped"
1807 (format-time-string "%A, %H:%M") 1807 (format-time-string "%A, %H:%M")
1808 feed-name) 1808 feed-name)
@@ -1995,8 +1995,7 @@ older than TIME."
1995 (mapc 1995 (mapc
1996 (lambda (item) 1996 (lambda (item)
1997 (when (eq (newsticker--age item) old-age) 1997 (when (eq (newsticker--age item) old-age)
1998 (let ((exp-time (time-add (newsticker--time item) 1998 (let ((exp-time (time-add (newsticker--time item) time)))
1999 (encode-time time))))
2000 (when (time-less-p exp-time nil) 1999 (when (time-less-p exp-time nil)
2001 (newsticker--debug-msg 2000 (newsticker--debug-msg
2002 "Item `%s' from %s has expired on %s" 2001 "Item `%s' from %s has expired on %s"
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 24f1c424dc8..b1a6c1ce8d2 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -670,8 +670,9 @@ last ping."
670 670
671(defun rcirc-handler-ctcp-KEEPALIVE (process _target _sender message) 671(defun rcirc-handler-ctcp-KEEPALIVE (process _target _sender message)
672 (with-rcirc-process-buffer process 672 (with-rcirc-process-buffer process
673 (setq header-line-format (format "%f" (- (float-time) 673 (setq header-line-format
674 (string-to-number message)))))) 674 (format "%f" (float-time
675 (time-since (string-to-number message)))))))
675 676
676(defvar rcirc-debug-buffer "*rcirc debug*") 677(defvar rcirc-debug-buffer "*rcirc debug*")
677(defvar rcirc-debug-flag nil 678(defvar rcirc-debug-flag nil
@@ -723,8 +724,8 @@ When 0, do not auto-reconnect."
723 (< 0 rcirc-reconnect-delay)) 724 (< 0 rcirc-reconnect-delay))
724 (let ((now (current-time))) 725 (let ((now (current-time)))
725 (when (or (null rcirc-last-connect-time) 726 (when (or (null rcirc-last-connect-time)
726 (< rcirc-reconnect-delay 727 (time-less-p rcirc-reconnect-delay
727 (float-time (time-subtract now rcirc-last-connect-time)))) 728 (time-subtract now rcirc-last-connect-time)))
728 (setq rcirc-last-connect-time now) 729 (setq rcirc-last-connect-time now)
729 (rcirc-cmd-reconnect nil)))) 730 (rcirc-cmd-reconnect nil))))
730 (run-hook-with-args 'rcirc-sentinel-functions process sentinel)))) 731 (run-hook-with-args 'rcirc-sentinel-functions process sentinel))))
@@ -2794,7 +2795,7 @@ the only argument."
2794 (let* ((nick (nth 1 args)) 2795 (let* ((nick (nth 1 args))
2795 (idle-secs (string-to-number (nth 2 args))) 2796 (idle-secs (string-to-number (nth 2 args)))
2796 (idle-string (format-seconds "%yy %dd %hh %mm %z%ss" idle-secs)) 2797 (idle-string (format-seconds "%yy %dd %hh %mm %z%ss" idle-secs))
2797 (signon-time (encode-time (string-to-number (nth 3 args)))) 2798 (signon-time (string-to-number (nth 3 args)))
2798 (signon-string (format-time-string "%c" signon-time)) 2799 (signon-string (format-time-string "%c" signon-time))
2799 (message (format "%s idle for %s, signed on %s" 2800 (message (format "%s idle for %s, signed on %s"
2800 nick idle-string signon-string))) 2801 nick idle-string signon-string)))
@@ -2815,8 +2816,7 @@ Not in rfc1459.txt"
2815 (with-current-buffer buffer 2816 (with-current-buffer buffer
2816 (let ((setter (nth 2 args)) 2817 (let ((setter (nth 2 args))
2817 (time (current-time-string 2818 (time (current-time-string
2818 (encode-time 2819 (string-to-number (cl-cadddr args)))))
2819 (string-to-number (cl-cadddr args))))))
2820 (rcirc-print process sender "TOPIC" (cadr args) 2820 (rcirc-print process sender "TOPIC" (cadr args)
2821 (format "%s (%s on %s)" rcirc-topic setter time)))))) 2821 (format "%s (%s on %s)" rcirc-topic setter time))))))
2822 2822
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index 487fc54dbd8..064b209ec2f 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -128,8 +128,9 @@ Returns DEFAULT if not set."
128 (and (consp value) 128 (and (consp value)
129 (or (null remote-file-name-inhibit-cache) 129 (or (null remote-file-name-inhibit-cache)
130 (and (integerp remote-file-name-inhibit-cache) 130 (and (integerp remote-file-name-inhibit-cache)
131 (<= (tramp-time-diff (current-time) (car value)) 131 (time-less-p nil
132 remote-file-name-inhibit-cache)) 132 (time-add (car value)
133 remote-file-name-inhibit-cache)))
133 (and (consp remote-file-name-inhibit-cache) 134 (and (consp remote-file-name-inhibit-cache)
134 (time-less-p 135 (time-less-p
135 remote-file-name-inhibit-cache (car value))))) 136 remote-file-name-inhibit-cache (car value)))))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 49bc9bfcfc3..91ff1532933 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1635,9 +1635,9 @@ of."
1635 (tramp-compat-time-equal-p 1635 (tramp-compat-time-equal-p
1636 (tramp-compat-file-attribute-modification-time fa2) 1636 (tramp-compat-file-attribute-modification-time fa2)
1637 tramp-time-dont-know))) 1637 tramp-time-dont-know)))
1638 (> 0 (tramp-time-diff 1638 (time-less-p
1639 (tramp-compat-file-attribute-modification-time fa2) 1639 (tramp-compat-file-attribute-modification-time fa2)
1640 (tramp-compat-file-attribute-modification-time fa1))) 1640 (tramp-compat-file-attribute-modification-time fa1))
1641 ;; If one of them is the dont-know value, then we can 1641 ;; If one of them is the dont-know value, then we can
1642 ;; still try to run a shell command on the remote host. 1642 ;; still try to run a shell command on the remote host.
1643 ;; However, this only works if both files are Tramp 1643 ;; However, this only works if both files are Tramp
@@ -4784,9 +4784,9 @@ connection if a previous connection has died for some reason."
4784 (unless (or (process-live-p p) 4784 (unless (or (process-live-p p)
4785 (not (tramp-file-name-equal-p 4785 (not (tramp-file-name-equal-p
4786 vec (car tramp-current-connection))) 4786 vec (car tramp-current-connection)))
4787 (> (tramp-time-diff 4787 (time-less-p
4788 (current-time) (cdr tramp-current-connection)) 4788 (or tramp-connection-min-time-diff 0)
4789 (or tramp-connection-min-time-diff 0))) 4789 (time-since (cdr tramp-current-connection))))
4790 (throw 'suppress 'suppress)) 4790 (throw 'suppress 'suppress))
4791 4791
4792 ;; If too much time has passed since last command was sent, look 4792 ;; If too much time has passed since last command was sent, look
@@ -4797,11 +4797,10 @@ connection if a previous connection has died for some reason."
4797 ;; try to send a command from time to time, then look again 4797 ;; try to send a command from time to time, then look again
4798 ;; whether the process is really alive. 4798 ;; whether the process is really alive.
4799 (condition-case nil 4799 (condition-case nil
4800 (when (and (> (tramp-time-diff 4800 (when (and (time-less-p 60
4801 (current-time) 4801 (time-since
4802 (tramp-get-connection-property 4802 (tramp-get-connection-property
4803 p "last-cmd-time" '(0 0 0))) 4803 p "last-cmd-time" 0)))
4804 60)
4805 (process-live-p p)) 4804 (process-live-p p))
4806 (tramp-send-command vec "echo are you awake" t t) 4805 (tramp-send-command vec "echo are you awake" t t)
4807 (unless (and (process-live-p p) 4806 (unless (and (process-live-p p)
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index f57c76c260b..31470b29790 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -1900,11 +1900,10 @@ If ARGUMENT is non-nil, use it as argument for
1900 ;; connection timeout. 1900 ;; connection timeout.
1901 (with-current-buffer buf 1901 (with-current-buffer buf
1902 (goto-char (point-min)) 1902 (goto-char (point-min))
1903 (when (and (> (tramp-time-diff 1903 (when (and (time-less-p 60
1904 (current-time) 1904 (time-since
1905 (tramp-get-connection-property 1905 (tramp-get-connection-property
1906 p "last-cmd-time" '(0 0 0))) 1906 p "last-cmd-time" 0)))
1907 60)
1908 (process-live-p p) 1907 (process-live-p p)
1909 (re-search-forward tramp-smb-errors nil t)) 1908 (re-search-forward tramp-smb-errors nil t))
1910 (delete-process p) 1909 (delete-process p)
diff --git a/lisp/nxml/rng-maint.el b/lisp/nxml/rng-maint.el
index 18e38989929..56fbf12eda9 100644
--- a/lisp/nxml/rng-maint.el
+++ b/lisp/nxml/rng-maint.el
@@ -228,8 +228,7 @@
228 (let* ((start (current-time)) 228 (let* ((start (current-time))
229 (val (apply function args))) 229 (val (apply function args)))
230 (message "%s ran in %g seconds" 230 (message "%s ran in %g seconds"
231 function 231 function (float-time (time-since start)))
232 (float-time (time-subtract nil start)))
233 val)) 232 val))
234 233
235(defun rng-time-tokenize-buffer () 234(defun rng-time-tokenize-buffer ()
diff --git a/lisp/obsolete/xesam.el b/lisp/obsolete/xesam.el
index a1a4639a234..16da6d9cbba 100644
--- a/lisp/obsolete/xesam.el
+++ b/lisp/obsolete/xesam.el
@@ -622,8 +622,7 @@ Return propertized STRING."
622 (or (widget-get widget :tag) "") 622 (or (widget-get widget :tag) "")
623 (format-time-string 623 (format-time-string
624 "%d %B %Y, %T" 624 "%d %B %Y, %T"
625 (encode-time 625 (string-to-number (widget-get widget :xesam:sourceModified))))))
626 (string-to-number (widget-get widget :xesam:sourceModified)))))))
627 626
628 ;; Second line: :value. 627 ;; Second line: :value.
629 (widget-put widget :value (widget-get widget :xesam:url)) 628 (widget-put widget :value (widget-get widget :xesam:url))
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index d491dff4779..6593c6d8fa1 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -5867,12 +5867,12 @@ See also the user option `org-agenda-clock-consistency-checks'."
5867 ((> dt (* 60 maxtime)) 5867 ((> dt (* 60 maxtime))
5868 ;; a very long clocking chunk 5868 ;; a very long clocking chunk
5869 (setq issue (format "Clocking interval is very long: %s" 5869 (setq issue (format "Clocking interval is very long: %s"
5870 (org-duration-from-minutes (floor (/ dt 60.)))) 5870 (org-duration-from-minutes (floor dt 60)))
5871 face (or (plist-get pl :long-face) face))) 5871 face (or (plist-get pl :long-face) face)))
5872 ((< dt (* 60 mintime)) 5872 ((< dt (* 60 mintime))
5873 ;; a very short clocking chunk 5873 ;; a very short clocking chunk
5874 (setq issue (format "Clocking interval is very short: %s" 5874 (setq issue (format "Clocking interval is very short: %s"
5875 (org-duration-from-minutes (floor (/ dt 60.)))) 5875 (org-duration-from-minutes (floor dt 60)))
5876 face (or (plist-get pl :short-face) face))) 5876 face (or (plist-get pl :short-face) face)))
5877 ((and (> tlend 0) (< ts tlend)) 5877 ((and (> tlend 0) (< ts tlend))
5878 ;; Two clock entries are overlapping 5878 ;; Two clock entries are overlapping
@@ -5912,8 +5912,8 @@ See also the user option `org-agenda-clock-consistency-checks'."
5912 (throw 'exit t)) 5912 (throw 'exit t))
5913 ;; We have a shorter gap. 5913 ;; We have a shorter gap.
5914 ;; Now we have to get the minute of the day when these times are 5914 ;; Now we have to get the minute of the day when these times are
5915 (let* ((t1dec (decode-time (encode-time t1))) 5915 (let* ((t1dec (decode-time t1))
5916 (t2dec (decode-time (encode-time t2))) 5916 (t2dec (decode-time t2))
5917 ;; compute the minute on the day 5917 ;; compute the minute on the day
5918 (min1 (+ (nth 1 t1dec) (* 60 (nth 2 t1dec)))) 5918 (min1 (+ (nth 1 t1dec) (* 60 (nth 2 t1dec))))
5919 (min2 (+ (nth 1 t2dec) (* 60 (nth 2 t2dec))))) 5919 (min2 (+ (nth 1 t2dec) (* 60 (nth 2 t2dec)))))
@@ -10157,8 +10157,7 @@ to override `appt-message-warning-time'."
10157 ;; Do not use `org-today' here because appt only takes 10157 ;; Do not use `org-today' here because appt only takes
10158 ;; time and without date as argument, so it may pass wrong 10158 ;; time and without date as argument, so it may pass wrong
10159 ;; information otherwise 10159 ;; information otherwise
10160 (today (org-date-to-gregorian 10160 (today (org-date-to-gregorian (time-to-days nil)))
10161 (time-to-days (current-time))))
10162 (org-agenda-restrict nil) 10161 (org-agenda-restrict nil)
10163 (files (org-agenda-files 'unrestricted)) entries file 10162 (files (org-agenda-files 'unrestricted)) entries file
10164 (org-agenda-buffer nil)) 10163 (org-agenda-buffer nil))
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el
index 0c7f159369f..dbba33b50d0 100644
--- a/lisp/org/org-capture.el
+++ b/lisp/org/org-capture.el
@@ -1000,8 +1000,7 @@ Store them in the capture property list."
1000 (equal current-prefix-arg 1)) 1000 (equal current-prefix-arg 1))
1001 ;; Prompt for date. 1001 ;; Prompt for date.
1002 (let ((prompt-time (org-read-date 1002 (let ((prompt-time (org-read-date
1003 nil t nil "Date for tree entry:" 1003 nil t nil "Date for tree entry:" nil)))
1004 (current-time))))
1005 (org-capture-put 1004 (org-capture-put
1006 :default-time 1005 :default-time
1007 (cond ((and (or (not (boundp 'org-time-was-given)) 1006 (cond ((and (or (not (boundp 'org-time-was-given))
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index babf1f70669..34b694d4879 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -723,7 +723,7 @@ menu\nmouse-2 will jump to task"))
723The time returned includes the time spent on this task in 723The time returned includes the time spent on this task in
724previous clocking intervals." 724previous clocking intervals."
725 (let ((currently-clocked-time 725 (let ((currently-clocked-time
726 (floor (encode-time (time-subtract nil org-clock-start-time) 'integer) 726 (floor (encode-time (time-since org-clock-start-time) 'integer)
727 60))) 727 60)))
728 (+ currently-clocked-time (or org-clock-total-time 0)))) 728 (+ currently-clocked-time (or org-clock-total-time 0))))
729 729
@@ -932,7 +932,7 @@ If necessary, clock-out of the currently active clock."
932 (unless (org-is-active-clock clock) 932 (unless (org-is-active-clock clock)
933 (org-clock-clock-in clock t)))) 933 (org-clock-clock-in clock t))))
934 934
935 ((not (time-less-p resolve-to (current-time))) 935 ((not (time-less-p resolve-to nil))
936 (error "RESOLVE-TO must refer to a time in the past")) 936 (error "RESOLVE-TO must refer to a time in the past"))
937 937
938 (t 938 (t
@@ -1033,8 +1033,7 @@ to be CLOCKED OUT."))))
1033 nil 45))) 1033 nil 45)))
1034 (and (not (memq char-pressed '(?i ?q))) char-pressed))))) 1034 (and (not (memq char-pressed '(?i ?q))) char-pressed)))))
1035 (default 1035 (default
1036 (floor (encode-time (time-subtract (current-time) last-valid) 1036 (floor (encode-time (time-since last-valid) 'integer)
1037 'integer)
1038 60)) 1037 60))
1039 (keep 1038 (keep
1040 (and (memq ch '(?k ?K)) 1039 (and (memq ch '(?k ?K))
@@ -1043,8 +1042,9 @@ to be CLOCKED OUT."))))
1043 (and (memq ch '(?g ?G)) 1042 (and (memq ch '(?g ?G))
1044 (read-number "Got back how many minutes ago? " default))) 1043 (read-number "Got back how many minutes ago? " default)))
1045 (subtractp (memq ch '(?s ?S))) 1044 (subtractp (memq ch '(?s ?S)))
1046 (barely-started-p (< (- (float-time last-valid) 1045 (barely-started-p (time-less-p
1047 (float-time (cdr clock))) 45)) 1046 (time-subtract last-valid (cdr clock))
1047 45))
1048 (start-over (and subtractp barely-started-p))) 1048 (start-over (and subtractp barely-started-p)))
1049 (cond 1049 (cond
1050 ((memq ch '(?j ?J)) 1050 ((memq ch '(?j ?J))
@@ -1070,10 +1070,9 @@ to be CLOCKED OUT."))))
1070 (and gotback (= gotback default))) 1070 (and gotback (= gotback default)))
1071 'now) 1071 'now)
1072 (keep 1072 (keep
1073 (time-add last-valid (encode-time (* 60 keep)))) 1073 (time-add last-valid (* 60 keep)))
1074 (gotback 1074 (gotback
1075 (time-subtract (current-time) 1075 (time-since (* 60 gotback)))
1076 (encode-time (* 60 gotback))))
1077 (t 1076 (t
1078 (error "Unexpected, please report this as a bug"))) 1077 (error "Unexpected, please report this as a bug")))
1079 (and gotback last-valid) 1078 (and gotback last-valid)
@@ -1103,7 +1102,7 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling
1103 (lambda (clock) 1102 (lambda (clock)
1104 (format 1103 (format
1105 "Dangling clock started %d mins ago" 1104 "Dangling clock started %d mins ago"
1106 (floor (encode-time (time-subtract nil (cdr clock)) 1105 (floor (encode-time (time-since (cdr clock))
1107 'integer) 1106 'integer)
1108 60))))) 1107 60)))))
1109 (or last-valid 1108 (or last-valid
@@ -1155,8 +1154,7 @@ so long."
1155 org-clock-marker (marker-buffer org-clock-marker)) 1154 org-clock-marker (marker-buffer org-clock-marker))
1156 (let* ((org-clock-user-idle-seconds (org-user-idle-seconds)) 1155 (let* ((org-clock-user-idle-seconds (org-user-idle-seconds))
1157 (org-clock-user-idle-start 1156 (org-clock-user-idle-start
1158 (time-subtract (current-time) 1157 (time-since org-clock-user-idle-seconds))
1159 (encode-time org-clock-user-idle-seconds)))
1160 (org-clock-resolving-clocks-due-to-idleness t)) 1158 (org-clock-resolving-clocks-due-to-idleness t))
1161 (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time)) 1159 (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time))
1162 (org-clock-resolve 1160 (org-clock-resolve
@@ -1165,9 +1163,8 @@ so long."
1165 (lambda (_) 1163 (lambda (_)
1166 (format "Clocked in & idle for %.1f mins" 1164 (format "Clocked in & idle for %.1f mins"
1167 (/ (float-time 1165 (/ (float-time
1168 (time-subtract (current-time) 1166 (time-since org-clock-user-idle-start))
1169 org-clock-user-idle-start)) 1167 60)))
1170 60.0)))
1171 org-clock-user-idle-start))))) 1168 org-clock-user-idle-start)))))
1172 1169
1173(defvar org-clock-current-task nil "Task currently clocked in.") 1170(defvar org-clock-current-task nil "Task currently clocked in.")
@@ -1324,9 +1321,11 @@ the default behavior."
1324 (y-or-n-p 1321 (y-or-n-p
1325 (format 1322 (format
1326 "You stopped another clock %d mins ago; start this one from then? " 1323 "You stopped another clock %d mins ago; start this one from then? "
1327 (/ (- (float-time 1324 (/ (encode-time
1328 (org-current-time org-clock-rounding-minutes t)) 1325 (time-subtract
1329 (float-time leftover)) 1326 (org-current-time org-clock-rounding-minutes t)
1327 leftover)
1328 'integer)
1330 60))) 1329 60)))
1331 leftover) 1330 leftover)
1332 start-time 1331 start-time
@@ -1577,19 +1576,19 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
1577 (delete-region (point) (point-at-eol)) 1576 (delete-region (point) (point-at-eol))
1578 (insert "--") 1577 (insert "--")
1579 (setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive)) 1578 (setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive))
1580 (setq s (float-time (time-subtract 1579 (setq s (encode-time (time-subtract
1581 (org-time-string-to-time te) 1580 (org-time-string-to-time te)
1582 (org-time-string-to-time ts))) 1581 (org-time-string-to-time ts))
1582 'integer)
1583 h (floor s 3600) 1583 h (floor s 3600)
1584 s (- s (* 3600 h)) 1584 m (floor (mod s 3600) 60))
1585 m (floor s 60))
1586 (insert " => " (format "%2d:%02d" h m)) 1585 (insert " => " (format "%2d:%02d" h m))
1587 (move-marker org-clock-marker nil) 1586 (move-marker org-clock-marker nil)
1588 (move-marker org-clock-hd-marker nil) 1587 (move-marker org-clock-hd-marker nil)
1589 ;; Possibly remove zero time clocks. However, do not add 1588 ;; Possibly remove zero time clocks. However, do not add
1590 ;; a note associated to the CLOCK line in this case. 1589 ;; a note associated to the CLOCK line in this case.
1591 (cond ((and org-clock-out-remove-zero-time-clocks 1590 (cond ((and org-clock-out-remove-zero-time-clocks
1592 (= (+ h m) 0)) 1591 (= 0 h m))
1593 (setq remove t) 1592 (setq remove t)
1594 (delete-region (line-beginning-position) 1593 (delete-region (line-beginning-position)
1595 (line-beginning-position 2))) 1594 (line-beginning-position 2)))
@@ -1833,8 +1832,9 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
1833 tend 1832 tend
1834 (>= (float-time org-clock-start-time) tstart) 1833 (>= (float-time org-clock-start-time) tstart)
1835 (<= (float-time org-clock-start-time) tend)) 1834 (<= (float-time org-clock-start-time) tend))
1836 (let ((time (floor (- (float-time) 1835 (let ((time (floor (encode-time
1837 (float-time org-clock-start-time)) 1836 (time-since org-clock-start-time)
1837 'integer)
1838 60))) 1838 60)))
1839 (setq t1 (+ t1 time)))) 1839 (setq t1 (+ t1 time))))
1840 (let* ((headline-forced 1840 (let* ((headline-forced
@@ -2712,14 +2712,14 @@ LEVEL is an integer. Indent by two spaces per level above 1."
2712 (setq te (float-time (org-time-string-to-time te))))) 2712 (setq te (float-time (org-time-string-to-time te)))))
2713 (setq tsb 2713 (setq tsb
2714 (if (eq step0 'week) 2714 (if (eq step0 'week)
2715 (let ((dow (nth 6 (decode-time (encode-time ts))))) 2715 (let ((dow (nth 6 (decode-time ts))))
2716 (if (<= dow ws) ts 2716 (if (<= dow ws) ts
2717 (- ts (* 86400 (- dow ws))))) 2717 (- ts (* 86400 (- dow ws)))))
2718 ts)) 2718 ts))
2719 (while (< tsb te) 2719 (while (< tsb te)
2720 (unless (bolp) (insert "\n")) 2720 (unless (bolp) (insert "\n"))
2721 (let ((start-time (max tsb ts))) 2721 (let ((start-time (max tsb ts)))
2722 (cl-incf tsb (let ((dow (nth 6 (decode-time (encode-time tsb))))) 2722 (cl-incf tsb (let ((dow (nth 6 (decode-time tsb))))
2723 (if (or (eq step0 'day) 2723 (if (or (eq step0 'day)
2724 (= dow ws)) 2724 (= dow ws))
2725 step 2725 step
@@ -2739,7 +2739,7 @@ LEVEL is an integer. Indent by two spaces per level above 1."
2739 :tstart (format-time-string (org-time-stamp-format t t) 2739 :tstart (format-time-string (org-time-stamp-format t t)
2740 start-time) 2740 start-time)
2741 :tend (format-time-string (org-time-stamp-format t t) 2741 :tend (format-time-string (org-time-stamp-format t t)
2742 (encode-time (min te tsb)))))))) 2742 (min te tsb)))))))
2743 (re-search-forward "^[ \t]*#\\+END:") 2743 (re-search-forward "^[ \t]*#\\+END:")
2744 (when (and stepskip0 (equal step-time 0)) 2744 (when (and stepskip0 (equal step-time 0))
2745 ;; Remove the empty table 2745 ;; Remove the empty table
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el
index f3e118b6dea..799cc608bfa 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."
540 (eol (line-end-position)) 540 (eol (line-end-position))
541 (pom (or (get-text-property bol 'org-hd-marker) (point))) 541 (pom (or (get-text-property bol 'org-hd-marker) (point)))
542 (key (or key (get-char-property (point) 'org-columns-key))) 542 (key (or key (get-char-property (point) 'org-columns-key)))
543 (org-columns--time (float-time (current-time))) 543 (org-columns--time (float-time))
544 (action 544 (action
545 (pcase key 545 (pcase key
546 ("CLOCKSUM" 546 ("CLOCKSUM"
@@ -790,7 +790,7 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column format."
790 (org-columns-goto-top-level) 790 (org-columns-goto-top-level)
791 ;; Initialize `org-columns-current-fmt' and 791 ;; Initialize `org-columns-current-fmt' and
792 ;; `org-columns-current-fmt-compiled'. 792 ;; `org-columns-current-fmt-compiled'.
793 (let ((org-columns--time (float-time (current-time)))) 793 (let ((org-columns--time (float-time)))
794 (org-columns-get-format columns-fmt-string) 794 (org-columns-get-format columns-fmt-string)
795 (unless org-columns-inhibit-recalculation (org-columns-compute-all)) 795 (unless org-columns-inhibit-recalculation (org-columns-compute-all))
796 (save-excursion 796 (save-excursion
@@ -1494,7 +1494,7 @@ PARAMS is a property list of parameters:
1494 (if (markerp org-columns-begin-marker) 1494 (if (markerp org-columns-begin-marker)
1495 (move-marker org-columns-begin-marker (point)) 1495 (move-marker org-columns-begin-marker (point))
1496 (setq org-columns-begin-marker (point-marker))) 1496 (setq org-columns-begin-marker (point-marker)))
1497 (let* ((org-columns--time (float-time (current-time))) 1497 (let* ((org-columns--time (float-time))
1498 (fmt 1498 (fmt
1499 (cond 1499 (cond
1500 ((bound-and-true-p org-agenda-overriding-columns-format)) 1500 ((bound-and-true-p org-agenda-overriding-columns-format))
diff --git a/lisp/org/org-duration.el b/lisp/org/org-duration.el
index f115082243b..770c72fd676 100644
--- a/lisp/org/org-duration.el
+++ b/lisp/org/org-duration.el
@@ -317,11 +317,10 @@ When optional argument CANONICAL is non-nil, ignore
317Raise an error if expected format is unknown." 317Raise an error if expected format is unknown."
318 (pcase (or fmt org-duration-format) 318 (pcase (or fmt org-duration-format)
319 (`h:mm 319 (`h:mm
320 (let ((minutes (floor minutes))) 320 (format "%d:%02d" (/ minutes 60) (mod minutes 60)))
321 (format "%d:%02d" (/ minutes 60) (mod minutes 60))))
322 (`h:mm:ss 321 (`h:mm:ss
323 (let* ((whole-minutes (floor minutes)) 322 (let* ((whole-minutes (floor minutes))
324 (seconds (floor (* 60 (- minutes whole-minutes))))) 323 (seconds (mod (* 60 minutes) 60)))
325 (format "%s:%02d" 324 (format "%s:%02d"
326 (org-duration-from-minutes whole-minutes 'h:mm) 325 (org-duration-from-minutes whole-minutes 'h:mm)
327 seconds))) 326 seconds)))
@@ -402,9 +401,7 @@ Raise an error if expected format is unknown."
402 (pcase-let* ((`(,unit . ,required?) units) 401 (pcase-let* ((`(,unit . ,required?) units)
403 (modifier (org-duration--modifier unit canonical))) 402 (modifier (org-duration--modifier unit canonical)))
404 (cond ((<= modifier minutes) 403 (cond ((<= modifier minutes)
405 (let ((value (if (integerp modifier) 404 (let ((value (floor minutes modifier)))
406 (/ (floor minutes) modifier)
407 (floor (/ minutes modifier)))))
408 (cl-decf minutes (* value modifier)) 405 (cl-decf minutes (* value modifier))
409 (format " %d%s" value unit))) 406 (format " %d%s" value unit)))
410 (required? (concat " 0" unit)) 407 (required? (concat " 0" unit))
diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el
index e2ee0a0fe82..690dcd139ef 100644
--- a/lisp/org/org-element.el
+++ b/lisp/org/org-element.el
@@ -4765,13 +4765,13 @@ you want to help debugging the issue.")
4765(defvar org-element-cache-sync-idle-time 0.6 4765(defvar org-element-cache-sync-idle-time 0.6
4766 "Length, in seconds, of idle time before syncing cache.") 4766 "Length, in seconds, of idle time before syncing cache.")
4767 4767
4768(defvar org-element-cache-sync-duration (encode-time 0.04) 4768(defvar org-element-cache-sync-duration 0.04
4769 "Maximum duration, as a time value, for a cache synchronization. 4769 "Maximum duration, as a time value, for a cache synchronization.
4770If the synchronization is not over after this delay, the process 4770If the synchronization is not over after this delay, the process
4771pauses and resumes after `org-element-cache-sync-break' 4771pauses and resumes after `org-element-cache-sync-break'
4772seconds.") 4772seconds.")
4773 4773
4774(defvar org-element-cache-sync-break (encode-time 0.3) 4774(defvar org-element-cache-sync-break 0.3
4775 "Duration, as a time value, of the pause between synchronizations. 4775 "Duration, as a time value, of the pause between synchronizations.
4776See `org-element-cache-sync-duration' for more information.") 4776See `org-element-cache-sync-duration' for more information.")
4777 4777
@@ -5066,7 +5066,7 @@ Assume ELEMENT belongs to cache and that a cache is active."
5066TIME-LIMIT is a time value or nil." 5066TIME-LIMIT is a time value or nil."
5067 (and time-limit 5067 (and time-limit
5068 (or (input-pending-p) 5068 (or (input-pending-p)
5069 (time-less-p time-limit (current-time))))) 5069 (time-less-p time-limit nil))))
5070 5070
5071(defsubst org-element--cache-shift-positions (element offset &optional props) 5071(defsubst org-element--cache-shift-positions (element offset &optional props)
5072 "Shift ELEMENT properties relative to buffer positions by OFFSET. 5072 "Shift ELEMENT properties relative to buffer positions by OFFSET.
@@ -5120,8 +5120,7 @@ updated before current modification are actually submitted."
5120 (and next (aref next 0)) 5120 (and next (aref next 0))
5121 threshold 5121 threshold
5122 (and (not threshold) 5122 (and (not threshold)
5123 (time-add (current-time) 5123 (time-add nil org-element-cache-sync-duration))
5124 org-element-cache-sync-duration))
5125 future-change) 5124 future-change)
5126 ;; Request processed. Merge current and next offsets and 5125 ;; Request processed. Merge current and next offsets and
5127 ;; transfer ending position. 5126 ;; transfer ending position.
diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el
index 06429d7ff37..6234d0251e9 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:
288 (deadline (if scheduled-days 288 (deadline (if scheduled-days
289 (+ scheduled-days (- d-repeat s-repeat)) 289 (+ scheduled-days (- d-repeat s-repeat))
290 (org-habit-deadline habit))) 290 (org-habit-deadline habit)))
291 (m-days (or now-days (time-to-days (current-time))))) 291 (m-days (or now-days (time-to-days nil))))
292 (cond 292 (cond
293 ((< m-days scheduled) 293 ((< m-days scheduled)
294 '(org-habit-clear-face . org-habit-clear-future-face)) 294 '(org-habit-clear-face . org-habit-clear-future-face))
@@ -406,8 +406,7 @@ current time."
406 "Insert consistency graph for any habitual tasks." 406 "Insert consistency graph for any habitual tasks."
407 (let ((inhibit-read-only t) 407 (let ((inhibit-read-only t)
408 (buffer-invisibility-spec '(org-link)) 408 (buffer-invisibility-spec '(org-link))
409 (moment (time-subtract (current-time) 409 (moment (time-since (* 3600 org-extend-today-until))))
410 (list 0 (* 3600 org-extend-today-until) 0))))
411 (save-excursion 410 (save-excursion
412 (goto-char (if line (point-at-bol) (point-min))) 411 (goto-char (if line (point-at-bol) (point-min)))
413 (while (not (eobp)) 412 (while (not (eobp))
diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el
index f6d6cd497f5..97cf8786566 100644
--- a/lisp/org/org-indent.el
+++ b/lisp/org/org-indent.el
@@ -332,7 +332,7 @@ stopped."
332 (let* ((case-fold-search t) 332 (let* ((case-fold-search t)
333 (limited-re (org-get-limited-outline-regexp)) 333 (limited-re (org-get-limited-outline-regexp))
334 (level (or (org-current-level) 0)) 334 (level (or (org-current-level) 0))
335 (time-limit (and delay (time-add (current-time) delay)))) 335 (time-limit (and delay (time-add nil delay))))
336 ;; For each line, set `line-prefix' and `wrap-prefix' 336 ;; For each line, set `line-prefix' and `wrap-prefix'
337 ;; properties depending on the type of line (headline, inline 337 ;; properties depending on the type of line (headline, inline
338 ;; task, item or other). 338 ;; task, item or other).
@@ -345,7 +345,7 @@ stopped."
345 ;; In asynchronous mode, take a break of 345 ;; In asynchronous mode, take a break of
346 ;; `org-indent-agent-resume-delay' every DELAY to avoid 346 ;; `org-indent-agent-resume-delay' every DELAY to avoid
347 ;; blocking any other idle timer or process output. 347 ;; blocking any other idle timer or process output.
348 ((and delay (time-less-p time-limit (current-time))) 348 ((and delay (time-less-p time-limit nil))
349 (setq org-indent-agent-resume-timer 349 (setq org-indent-agent-resume-timer
350 (run-with-idle-timer 350 (run-with-idle-timer
351 (time-add (current-idle-time) org-indent-agent-resume-delay) 351 (time-add (current-idle-time) org-indent-agent-resume-delay)
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index 81a77fde6c7..765a1ee5c92 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -2175,8 +2175,8 @@ If NLAST is a number, only the NLAST fields will actually be summed."
2175 (sres (if (= org-timecnt 0) 2175 (sres (if (= org-timecnt 0)
2176 (number-to-string res) 2176 (number-to-string res)
2177 (setq diff (* 3600 res) 2177 (setq diff (* 3600 res)
2178 h (floor (/ diff 3600)) diff (mod diff 3600) 2178 h (floor diff 3600) diff (mod diff 3600)
2179 m (floor (/ diff 60)) diff (mod diff 60) 2179 m (floor diff 60) diff (mod diff 60)
2180 s diff) 2180 s diff)
2181 (format "%.0f:%02.0f:%02.0f" h m s)))) 2181 (format "%.0f:%02.0f:%02.0f" h m s))))
2182 (kill-new sres) 2182 (kill-new sres)
diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el
index c9ca85c0c39..6529a8b0ddf 100644
--- a/lisp/org/org-timer.el
+++ b/lisp/org/org-timer.el
@@ -139,12 +139,7 @@ the region 0:00:00."
139 (format "Restart timer with offset [%s]: " def))) 139 (format "Restart timer with offset [%s]: " def)))
140 (unless (string-match "\\S-" s) (setq s def)) 140 (unless (string-match "\\S-" s) (setq s def))
141 (setq delta (org-timer-hms-to-secs (org-timer-fix-incomplete s))))) 141 (setq delta (org-timer-hms-to-secs (org-timer-fix-incomplete s)))))
142 (setq org-timer-start-time 142 (setq org-timer-start-time (time-since delta)))
143 (encode-time
144 ;; Pass `current-time' result to `float-time' (instead
145 ;; of calling without arguments) so that only
146 ;; `current-time' has to be overridden in tests.
147 (- (float-time (current-time)) delta))))
148 (setq org-timer-pause-time nil) 143 (setq org-timer-pause-time nil)
149 (org-timer-set-mode-line 'on) 144 (org-timer-set-mode-line 'on)
150 (message "Timer start time set to %s, current value is %s" 145 (message "Timer start time set to %s, current value is %s"
@@ -167,14 +162,9 @@ With prefix arg STOP, stop it entirely."
167 (setq org-timer-countdown-timer 162 (setq org-timer-countdown-timer
168 (org-timer--run-countdown-timer 163 (org-timer--run-countdown-timer
169 new-secs org-timer-countdown-timer-title)) 164 new-secs org-timer-countdown-timer-title))
170 (setq org-timer-start-time 165 (setq org-timer-start-time (time-add nil new-secs)))
171 (time-add (current-time) (encode-time new-secs))))
172 (setq org-timer-start-time 166 (setq org-timer-start-time
173 ;; Pass `current-time' result to `float-time' (instead 167 (time-since (- pause-secs start-secs))))
174 ;; of calling without arguments) so that only
175 ;; `current-time' has to be overridden in tests.
176 (encode-time (- (float-time (current-time))
177 (- pause-secs start-secs)))))
178 (setq org-timer-pause-time nil) 168 (setq org-timer-pause-time nil)
179 (org-timer-set-mode-line 'on) 169 (org-timer-set-mode-line 'on)
180 (run-hooks 'org-timer-continue-hook) 170 (run-hooks 'org-timer-continue-hook)
@@ -233,14 +223,9 @@ it in the buffer."
233 (abs (floor (org-timer-seconds)))))) 223 (abs (floor (org-timer-seconds))))))
234 224
235(defun org-timer-seconds () 225(defun org-timer-seconds ()
236 ;; Pass `current-time' result to `float-time' (instead of calling 226 (let ((s (float-time (time-subtract org-timer-pause-time
237 ;; without arguments) so that only `current-time' has to be 227 org-timer-start-time))))
238 ;; overridden in tests. 228 (if org-timer-countdown-timer (- s) s)))
239 (if org-timer-countdown-timer
240 (- (float-time org-timer-start-time)
241 (float-time (or org-timer-pause-time (current-time))))
242 (- (float-time (or org-timer-pause-time (current-time)))
243 (float-time org-timer-start-time))))
244 229
245;;;###autoload 230;;;###autoload
246(defun org-timer-change-times-in-region (beg end delta) 231(defun org-timer-change-times-in-region (beg end delta)
@@ -400,7 +385,7 @@ VALUE can be `on', `off', or `paused'."
400 (message "No timer set") 385 (message "No timer set")
401 (let* ((rtime (decode-time 386 (let* ((rtime (decode-time
402 (time-subtract (timer--time org-timer-countdown-timer) 387 (time-subtract (timer--time org-timer-countdown-timer)
403 (current-time)))) 388 nil)))
404 (rsecs (nth 0 rtime)) 389 (rsecs (nth 0 rtime))
405 (rmins (nth 1 rtime))) 390 (rmins (nth 1 rtime)))
406 (message "%d minute(s) %d seconds left before next time out" 391 (message "%d minute(s) %d seconds left before next time out"
@@ -463,8 +448,7 @@ using three `C-u' prefix arguments."
463 (org-timer--run-countdown-timer 448 (org-timer--run-countdown-timer
464 secs org-timer-countdown-timer-title)) 449 secs org-timer-countdown-timer-title))
465 (run-hooks 'org-timer-set-hook) 450 (run-hooks 'org-timer-set-hook)
466 (setq org-timer-start-time 451 (setq org-timer-start-time (time-add nil secs))
467 (time-add (current-time) (encode-time secs)))
468 (setq org-timer-pause-time nil) 452 (setq org-timer-pause-time nil)
469 (org-timer-set-mode-line 'on)))))) 453 (org-timer-set-mode-line 'on))))))
470 454
diff --git a/lisp/org/org.el b/lisp/org/org.el
index b627282a63d..8a11a8f75ef 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -229,10 +229,10 @@ file to byte-code before it is loaded."
229 (interactive "fFile to load: \nP") 229 (interactive "fFile to load: \nP")
230 (let* ((age (lambda (file) 230 (let* ((age (lambda (file)
231 (float-time 231 (float-time
232 (time-subtract (current-time) 232 (time-since
233 (file-attribute-modification-time 233 (file-attribute-modification-time
234 (or (file-attributes (file-truename file)) 234 (or (file-attributes (file-truename file))
235 (file-attributes file))))))) 235 (file-attributes file)))))))
236 (base-name (file-name-sans-extension file)) 236 (base-name (file-name-sans-extension file))
237 (exported-file (concat base-name ".el"))) 237 (exported-file (concat base-name ".el")))
238 ;; tangle if the Org file is newer than the elisp file 238 ;; tangle if the Org file is newer than the elisp file
@@ -5626,8 +5626,7 @@ the rounding returns a past time."
5626(defun org-today () 5626(defun org-today ()
5627 "Return today date, considering `org-extend-today-until'." 5627 "Return today date, considering `org-extend-today-until'."
5628 (time-to-days 5628 (time-to-days
5629 (time-subtract (current-time) 5629 (time-since (* 3600 org-extend-today-until))))
5630 (list 0 (* 3600 org-extend-today-until) 0))))
5631 5630
5632;;;; Font-Lock stuff, including the activators 5631;;;; Font-Lock stuff, including the activators
5633 5632
@@ -13110,8 +13109,7 @@ This function is run automatically after each state change to a DONE state."
13110 (while (re-search-forward org-clock-line-re end t) 13109 (while (re-search-forward org-clock-line-re end t)
13111 (when (org-at-clock-log-p) (throw :clock t)))))) 13110 (when (org-at-clock-log-p) (throw :clock t))))))
13112 (org-entry-put nil "LAST_REPEAT" (format-time-string 13111 (org-entry-put nil "LAST_REPEAT" (format-time-string
13113 (org-time-stamp-format t t) 13112 (org-time-stamp-format t t))))
13114 (current-time))))
13115 (when org-log-repeat 13113 (when org-log-repeat
13116 (if (or (memq 'org-add-log-note (default-value 'post-command-hook)) 13114 (if (or (memq 'org-add-log-note (default-value 'post-command-hook))
13117 (memq 'org-add-log-note post-command-hook)) 13115 (memq 'org-add-log-note post-command-hook))
@@ -13170,7 +13168,7 @@ has been set"
13170 (let ((nshiftmax 10) 13168 (let ((nshiftmax 10)
13171 (nshift 0)) 13169 (nshift 0))
13172 (while (or (= nshift 0) 13170 (while (or (= nshift 0)
13173 (not (time-less-p (current-time) time))) 13171 (not (time-less-p nil time)))
13174 (when (= (cl-incf nshift) nshiftmax) 13172 (when (= (cl-incf nshift) nshiftmax)
13175 (or (y-or-n-p 13173 (or (y-or-n-p
13176 (format "%d repeater intervals were not \ 13174 (format "%d repeater intervals were not \
@@ -14666,8 +14664,8 @@ it as a time string and apply `float-time' to it. If S is nil, just return 0."
14666 ((stringp s) 14664 ((stringp s)
14667 (condition-case nil 14665 (condition-case nil
14668 (float-time (org-time-string-to-time s)) 14666 (float-time (org-time-string-to-time s))
14669 (error 0.))) 14667 (error 0)))
14670 (t 0.))) 14668 (t 0)))
14671 14669
14672(defun org-time-today () 14670(defun org-time-today ()
14673 "Time in seconds today at 0:00. 14671 "Time in seconds today at 0:00.
@@ -16568,22 +16566,20 @@ non-nil."
16568 ((org-at-timestamp-p 'lax) (match-string 0)))) 16566 ((org-at-timestamp-p 'lax) (match-string 0))))
16569 ;; Default time is either the timestamp at point or today. 16567 ;; Default time is either the timestamp at point or today.
16570 ;; When entering a range, only the range start is considered. 16568 ;; When entering a range, only the range start is considered.
16571 (default-time (if (not ts) (current-time) 16569 (default-time (and ts (org-time-string-to-time ts)))
16572 (org-time-string-to-time ts)))
16573 (default-input (and ts (org-get-compact-tod ts))) 16570 (default-input (and ts (org-get-compact-tod ts)))
16574 (repeater (and ts 16571 (repeater (and ts
16575 (string-match "\\([.+-]+[0-9]+[hdwmy] ?\\)+" ts) 16572 (string-match "\\([.+-]+[0-9]+[hdwmy] ?\\)+" ts)
16576 (match-string 0 ts))) 16573 (match-string 0 ts)))
16577 org-time-was-given 16574 org-time-was-given
16578 org-end-time-was-given 16575 org-end-time-was-given
16579 (time 16576 (time (if (equal arg '(16)) (current-time)
16580 (and (if (equal arg '(16)) (current-time)
16581 ;; Preserve `this-command' and `last-command'. 16577 ;; Preserve `this-command' and `last-command'.
16582 (let ((this-command this-command) 16578 (let ((this-command this-command)
16583 (last-command last-command)) 16579 (last-command last-command))
16584 (org-read-date 16580 (org-read-date
16585 arg 'totime nil nil default-time default-input 16581 arg 'totime nil nil default-time default-input
16586 inactive)))))) 16582 inactive)))))
16587 (cond 16583 (cond
16588 ((and ts 16584 ((and ts
16589 (memq last-command '(org-time-stamp org-time-stamp-inactive)) 16585 (memq last-command '(org-time-stamp org-time-stamp-inactive))
@@ -16957,7 +16953,7 @@ user."
16957 (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans) 16953 (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans)
16958 (setq ans "+0")) 16954 (setq ans "+0"))
16959 16955
16960 (when (setq delta (org-read-date-get-relative ans (current-time) org-def)) 16956 (when (setq delta (org-read-date-get-relative ans nil org-def))
16961 (setq ans (replace-match "" t t ans) 16957 (setq ans (replace-match "" t t ans)
16962 deltan (car delta) 16958 deltan (car delta)
16963 deltaw (nth 1 delta) 16959 deltaw (nth 1 delta)
@@ -17114,7 +17110,7 @@ user."
17114 ; (when (and org-read-date-prefer-future 17110 ; (when (and org-read-date-prefer-future
17115 ; (not iso-year) 17111 ; (not iso-year)
17116 ; (< (calendar-absolute-from-gregorian iso-date) 17112 ; (< (calendar-absolute-from-gregorian iso-date)
17117 ; (time-to-days (current-time)))) 17113 ; (time-to-days nil)))
17118 ; (setq year (1+ year) 17114 ; (setq year (1+ year)
17119 ; iso-date (calendar-gregorian-from-absolute 17115 ; iso-date (calendar-gregorian-from-absolute
17120 ; (calendar-iso-to-absolute 17116 ; (calendar-iso-to-absolute
@@ -17308,7 +17304,7 @@ Don't touch the rest."
17308If SECONDS is non-nil, return the difference in seconds." 17304If SECONDS is non-nil, return the difference in seconds."
17309 (let ((fdiff (if seconds #'float-time #'time-to-days))) 17305 (let ((fdiff (if seconds #'float-time #'time-to-days)))
17310 (- (funcall fdiff (org-time-string-to-time timestamp-string)) 17306 (- (funcall fdiff (org-time-string-to-time timestamp-string))
17311 (funcall fdiff (current-time))))) 17307 (funcall fdiff nil))))
17312 17308
17313(defun org-deadline-close-p (timestamp-string &optional ndays) 17309(defun org-deadline-close-p (timestamp-string &optional ndays)
17314 "Is the time in TIMESTAMP-STRING close to the current date?" 17310 "Is the time in TIMESTAMP-STRING close to the current date?"
@@ -17490,10 +17486,8 @@ days in order to avoid rounding problems."
17490 (match-end (match-end 0)) 17486 (match-end (match-end 0))
17491 (time1 (org-time-string-to-time ts1)) 17487 (time1 (org-time-string-to-time ts1))
17492 (time2 (org-time-string-to-time ts2)) 17488 (time2 (org-time-string-to-time ts2))
17493 (t1 (float-time time1)) 17489 (diff (abs (float-time (time-subtract time2 time1))))
17494 (t2 (float-time time2)) 17490 (negative (time-less-p time2 time1))
17495 (diff (abs (- t2 t1)))
17496 (negative (< (- t2 t1) 0))
17497 ;; (ys (floor (* 365 24 60 60))) 17491 ;; (ys (floor (* 365 24 60 60)))
17498 (ds (* 24 60 60)) 17492 (ds (* 24 60 60))
17499 (hs (* 60 60)) 17493 (hs (* 60 60))
@@ -17504,14 +17498,14 @@ days in order to avoid rounding problems."
17504 (fh "%02d:%02d") 17498 (fh "%02d:%02d")
17505 y d h m align) 17499 y d h m align)
17506 (if havetime 17500 (if havetime
17507 (setq ; y (floor (/ diff ys)) diff (mod diff ys) 17501 (setq ; y (floor diff ys) diff (mod diff ys)
17508 y 0 17502 y 0
17509 d (floor (/ diff ds)) diff (mod diff ds) 17503 d (floor diff ds) diff (mod diff ds)
17510 h (floor (/ diff hs)) diff (mod diff hs) 17504 h (floor diff hs) diff (mod diff hs)
17511 m (floor (/ diff 60))) 17505 m (floor diff 60))
17512 (setq ; y (floor (/ diff ys)) diff (mod diff ys) 17506 (setq ; y (floor diff ys) diff (mod diff ys)
17513 y 0 17507 y 0
17514 d (floor (+ (/ diff ds) 0.5)) 17508 d (round diff ds)
17515 h 0 m 0)) 17509 h 0 m 0))
17516 (if (not to-buffer) 17510 (if (not to-buffer)
17517 (message "%s" (org-make-tdiff-string y d h m)) 17511 (message "%s" (org-make-tdiff-string y d h m))
@@ -17602,7 +17596,7 @@ signaled."
17602YEAR is expanded into one of the 30 next years, if possible, or 17596YEAR is expanded into one of the 30 next years, if possible, or
17603into a past one. Any year larger than 99 is returned unchanged." 17597into a past one. Any year larger than 99 is returned unchanged."
17604 (if (>= year 100) year 17598 (if (>= year 100) year
17605 (let* ((current (string-to-number (format-time-string "%Y" (current-time)))) 17599 (let* ((current (string-to-number (format-time-string "%Y")))
17606 (century (/ current 100)) 17600 (century (/ current 100))
17607 (offset (- year (% current 100)))) 17601 (offset (- year (% current 100))))
17608 (cond ((> offset 30) (+ (* (1- century) 100) year)) 17602 (cond ((> offset 30) (+ (* (1- century) 100) year))
@@ -18122,7 +18116,7 @@ A prefix ARG can be used to force the current date."
18122 diff) 18116 diff)
18123 (when (or (org-at-timestamp-p 'lax) 18117 (when (or (org-at-timestamp-p 'lax)
18124 (org-match-line (concat ".*" org-ts-regexp))) 18118 (org-match-line (concat ".*" org-ts-regexp)))
18125 (let ((d1 (time-to-days (current-time))) 18119 (let ((d1 (time-to-days nil))
18126 (d2 (time-to-days (org-time-string-to-time (match-string 1))))) 18120 (d2 (time-to-days (org-time-string-to-time (match-string 1)))))
18127 (setq diff (- d2 d1)))) 18121 (setq diff (- d2 d1))))
18128 (calendar) 18122 (calendar)
diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el
index bc86a4d5635..74312bc20f8 100644
--- a/lisp/org/ox-publish.el
+++ b/lisp/org/ox-publish.el
@@ -1348,7 +1348,7 @@ does not exist."
1348 (expand-file-name (or (file-symlink-p file) file) 1348 (expand-file-name (or (file-symlink-p file) file)
1349 (file-name-directory file))))) 1349 (file-name-directory file)))))
1350 (if (not attr) (error "No such file: \"%s\"" file) 1350 (if (not attr) (error "No such file: \"%s\"" file)
1351 (floor (float-time (file-attribute-modification-time attr)))))) 1351 (encode-time (file-attribute-modification-time attr) 'integer))))
1352 1352
1353 1353
1354(provide 'ox-publish) 1354(provide 'ox-publish)
diff --git a/lisp/org/ox.el b/lisp/org/ox.el
index 6c278a1b7cf..8813968332e 100644
--- a/lisp/org/ox.el
+++ b/lisp/org/ox.el
@@ -3252,7 +3252,7 @@ locally for the subtree through node properties."
3252 (let ((val (cond ((equal (car key) "DATE") 3252 (let ((val (cond ((equal (car key) "DATE")
3253 (or (cdr key) 3253 (or (cdr key)
3254 (with-temp-buffer 3254 (with-temp-buffer
3255 (org-insert-time-stamp (current-time))))) 3255 (org-insert-time-stamp nil))))
3256 ((equal (car key) "TITLE") 3256 ((equal (car key) "TITLE")
3257 (or (let ((visited-file 3257 (or (let ((visited-file
3258 (buffer-file-name (buffer-base-buffer)))) 3258 (buffer-file-name (buffer-base-buffer))))
diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
index 566a0fdb776..dfd9a5ad5b3 100644
--- a/lisp/pixel-scroll.el
+++ b/lisp/pixel-scroll.el
@@ -97,10 +97,11 @@ When scrolling request is delivered soon after the previous one,
97user is in hurry. When the time since last scroll is larger than 97user is in hurry. When the time since last scroll is larger than
98`pixel-dead-time', we are ready for another smooth scroll, and this 98`pixel-dead-time', we are ready for another smooth scroll, and this
99function returns nil." 99function returns nil."
100 (let* ((current-time (float-time)) 100 (let* ((now (current-time))
101 (scroll-in-rush-p (< (- current-time pixel-last-scroll-time) 101 (scroll-in-rush-p (time-less-p
102 pixel-dead-time))) 102 (time-subtract now pixel-last-scroll-time)
103 (setq pixel-last-scroll-time current-time) 103 pixel-dead-time)))
104 (setq pixel-last-scroll-time (float-time now))
104 scroll-in-rush-p)) 105 scroll-in-rush-p))
105 106
106;;;###autoload 107;;;###autoload
diff --git a/lisp/play/hanoi.el b/lisp/play/hanoi.el
index 635e4a95bc3..d762290f0da 100644
--- a/lisp/play/hanoi.el
+++ b/lisp/play/hanoi.el
@@ -381,7 +381,7 @@ BITS must be of length nrings. Start at START-TIME."
381 (cl-loop for elapsed = (- (float-time) start-time) 381 (cl-loop for elapsed = (- (float-time) start-time)
382 while (< elapsed hanoi-move-period) 382 while (< elapsed hanoi-move-period)
383 with tick-period = (/ (float hanoi-move-period) total-ticks) 383 with tick-period = (/ (float hanoi-move-period) total-ticks)
384 for tick = (ceiling (/ elapsed tick-period)) do 384 for tick = (ceiling elapsed tick-period) do
385 (hanoi-ring-to-pos ring (funcall tick-to-pos tick)) 385 (hanoi-ring-to-pos ring (funcall tick-to-pos tick))
386 (hanoi-sit-for (- (* tick tick-period) elapsed))) 386 (hanoi-sit-for (- (* tick tick-period) elapsed)))
387 (cl-loop for tick from 1 to total-ticks by 2 do 387 (cl-loop for tick from 1 to total-ticks by 2 do
diff --git a/lisp/proced.el b/lisp/proced.el
index b3c8e2cb698..ce379a7c6aa 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -1348,7 +1348,7 @@ Prefix ARG controls sort order, see `proced-sort-interactive'."
1348 1348
1349(defun proced-format-time (time) 1349(defun proced-format-time (time)
1350 "Format time interval TIME." 1350 "Format time interval TIME."
1351 (let* ((ftime (float-time time)) 1351 (let* ((ftime (encode-time time 'integer))
1352 (days (truncate ftime 86400)) 1352 (days (truncate ftime 86400))
1353 (ftime (mod ftime 86400)) 1353 (ftime (mod ftime 86400))
1354 (hours (truncate ftime 3600)) 1354 (hours (truncate ftime 3600))
diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el
index afdf6a96e1d..29988eb14f3 100644
--- a/lisp/progmodes/cpp.el
+++ b/lisp/progmodes/cpp.el
@@ -849,8 +849,8 @@ If that option is nil, don't prints messages.
849ARGS are the same as for `message'." 849ARGS are the same as for `message'."
850 (when cpp-message-min-time-interval 850 (when cpp-message-min-time-interval
851 (let ((time (current-time))) 851 (let ((time (current-time)))
852 (when (>= (float-time (time-subtract time cpp-progress-time)) 852 (unless (time-less-p cpp-message-min-time-interval
853 cpp-message-min-time-interval) 853 (time-subtract time cpp-progress-time))
854 (setq cpp-progress-time time) 854 (setq cpp-progress-time time)
855 (apply 'message args))))) 855 (apply 'message args)))))
856 856
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 261e50a613f..7afcf7891de 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -765,7 +765,8 @@ report applies to that region."
765 (flymake-log :debug "backend %s reported %d diagnostics in %.2f second(s)" 765 (flymake-log :debug "backend %s reported %d diagnostics in %.2f second(s)"
766 backend 766 backend
767 (length new-diags) 767 (length new-diags)
768 (- (float-time) flymake-check-start-time))) 768 (float-time
769 (time-since flymake-check-start-time))))
769 (when (and (get-buffer (flymake--diagnostics-buffer-name)) 770 (when (and (get-buffer (flymake--diagnostics-buffer-name))
770 (get-buffer-window (flymake--diagnostics-buffer-name)) 771 (get-buffer-window (flymake--diagnostics-buffer-name))
771 (null (cl-set-difference (flymake-running-backends) 772 (null (cl-set-difference (flymake-running-backends)
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index b0bb8213dcb..532739daae1 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -2771,8 +2771,8 @@ Otherwise, use the current value of `process-mark'."
2771 (with-current-buffer (process-buffer process) 2771 (with-current-buffer (process-buffer process)
2772 (cl-loop with start-pos = (or start 2772 (cl-loop with start-pos = (or start
2773 (marker-position (process-mark process))) 2773 (marker-position (process-mark process)))
2774 with end-time = (+ (float-time) timeout) 2774 with end-time = (time-add nil timeout)
2775 for time-left = (- end-time (float-time)) 2775 for time-left = (float-time (time-subtract end-time nil))
2776 do (goto-char (point-max)) 2776 do (goto-char (point-max))
2777 if (looking-back regexp start-pos) return t 2777 if (looking-back regexp start-pos) return t
2778 while (> time-left 0) 2778 while (> time-left 0)
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index 27380b33adb..b8297c4847e 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -7393,7 +7393,7 @@ only-lines."
7393 "Update progress information." 7393 "Update progress information."
7394 (when (and vhdl-progress-info (not noninteractive) 7394 (when (and vhdl-progress-info (not noninteractive)
7395 (time-less-p vhdl-progress-interval 7395 (time-less-p vhdl-progress-interval
7396 (time-subtract nil (aref vhdl-progress-info 2)))) 7396 (time-since (aref vhdl-progress-info 2))))
7397 (let ((delta (- (aref vhdl-progress-info 1) 7397 (let ((delta (- (aref vhdl-progress-info 1)
7398 (aref vhdl-progress-info 0)))) 7398 (aref vhdl-progress-info 0))))
7399 (message "%s... (%2d%%)" string 7399 (message "%s... (%2d%%)" string
@@ -8143,7 +8143,7 @@ depending on parameter UPPER-CASE."
8143 (downcase-word -1))) 8143 (downcase-word -1)))
8144 (when (and count vhdl-progress-interval (not noninteractive) 8144 (when (and count vhdl-progress-interval (not noninteractive)
8145 (time-less-p vhdl-progress-interval 8145 (time-less-p vhdl-progress-interval
8146 (time-subtract nil last-update))) 8146 (time-since last-update)))
8147 (message "Fixing case... (%2d%s)" 8147 (message "Fixing case... (%2d%s)"
8148 (+ (* count 20) (/ (* 20 (- (point) beg)) (- end beg))) 8148 (+ (* count 20) (/ (* 20 (- (point) beg)) (- end beg)))
8149 "%") 8149 "%")
diff --git a/lisp/ses.el b/lisp/ses.el
index df32363aa1d..73157d6f5f0 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -837,7 +837,7 @@ updated again."
837(defmacro ses--time-check (format &rest args) 837(defmacro ses--time-check (format &rest args)
838 "If `ses-start-time' is more than a second ago, call `message' with FORMAT 838 "If `ses-start-time' is more than a second ago, call `message' with FORMAT
839and ARGS and reset `ses-start-time' to the current time." 839and ARGS and reset `ses-start-time' to the current time."
840 `(when (> (- (float-time) ses-start-time) 1.0) 840 `(when (time-less-p 1 (time-since ses-start-time))
841 (message ,format ,@args) 841 (message ,format ,@args)
842 (setq ses-start-time (float-time)))) 842 (setq ses-start-time (float-time))))
843 843
diff --git a/lisp/subr.el b/lisp/subr.el
index 44a1c608949..69ae804e200 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -5041,7 +5041,7 @@ NEW-MESSAGE, if non-nil, sets a new message for the reporter."
5041 (enough-time-passed 5041 (enough-time-passed
5042 ;; See if enough time has passed since the last update. 5042 ;; See if enough time has passed since the last update.
5043 (or (not update-time) 5043 (or (not update-time)
5044 (when (>= (float-time) update-time) 5044 (when (time-less-p update-time nil)
5045 ;; Calculate time for the next update 5045 ;; Calculate time for the next update
5046 (aset parameters 0 (+ update-time (aref parameters 5))))))) 5046 (aset parameters 0 (+ update-time (aref parameters 5)))))))
5047 (cond ((and min-value max-value) 5047 (cond ((and min-value max-value)
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 0973329fa3a..c4b0a8fb6e6 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -767,13 +767,15 @@ Can be nil to mean \"no timeout\".")
767By not redisplaying right away for xterm queries, we can avoid 767By not redisplaying right away for xterm queries, we can avoid
768unsightly flashing during initialization. Give up and redisplay 768unsightly flashing during initialization. Give up and redisplay
769anyway if we've been waiting a little while." 769anyway if we've been waiting a little while."
770 (let ((start-time (float-time))) 770 (let ((start-time (current-time)))
771 (or (let ((inhibit-redisplay t)) 771 (or (let ((inhibit-redisplay t))
772 (read-event nil nil xterm-query-redisplay-timeout)) 772 (read-event nil nil xterm-query-redisplay-timeout))
773 (read-event nil nil 773 (read-event nil nil
774 (and xterm-query-timeout 774 (and xterm-query-timeout
775 (max 0 (+ start-time xterm-query-timeout 775 (max 0 (float-time
776 (- (float-time))))))))) 776 (time-subtract
777 xterm-query-timeout
778 (time-since start-time)))))))))
777 779
778(defun xterm--query (query handlers &optional no-async) 780(defun xterm--query (query handlers &optional no-async)
779 "Send QUERY string to the terminal and watch for a response. 781 "Send QUERY string to the terminal and watch for a response.
diff --git a/lisp/time.el b/lisp/time.el
index 9084217024a..35157c5e807 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -434,16 +434,17 @@ update which can wait for the next redisplay."
434 ((and (stringp mail-spool-file) 434 ((and (stringp mail-spool-file)
435 (or (null display-time-server-down-time) 435 (or (null display-time-server-down-time)
436 ;; If have been down for 20 min, try again. 436 ;; If have been down for 20 min, try again.
437 (< 1200 (- (float-time now) 437 (time-less-p 1200 (time-since
438 display-time-server-down-time)))) 438 display-time-server-down-time))))
439 (let ((start-time (float-time))) 439 (let ((start-time (current-time)))
440 (prog1 440 (prog1
441 (display-time-file-nonempty-p mail-spool-file) 441 (display-time-file-nonempty-p mail-spool-file)
442 ;; Record whether mail file is accessible. 442 ;; Record whether mail file is accessible.
443 (setq display-time-server-down-time 443 (setq display-time-server-down-time
444 (let ((end-time (float-time))) 444 (let ((end-time (current-time)))
445 (and (< 20 (- end-time start-time)) 445 (and (time-less-p 20 (time-subtract
446 end-time)))))))) 446 end-time start-time))
447 (float-time end-time)))))))))
447 (24-hours (substring time 11 13)) 448 (24-hours (substring time 11 13))
448 (hour (string-to-number 24-hours)) 449 (hour (string-to-number 24-hours))
449 (12-hours (int-to-string (1+ (% (+ hour 11) 12)))) 450 (12-hours (int-to-string (1+ (% (+ hour 11) 12))))
@@ -571,8 +572,9 @@ For example, the Unix uptime command format is \"%D, %z%2h:%.2m\"."
571 (interactive) 572 (interactive)
572 (let ((str 573 (let ((str
573 (format-seconds (or format "%Y, %D, %H, %M, %z%S") 574 (format-seconds (or format "%Y, %D, %H, %M, %z%S")
574 (float-time 575 (encode-time
575 (time-subtract nil before-init-time))))) 576 (time-since before-init-time)
577 'integer))))
576 (if (called-interactively-p 'interactive) 578 (if (called-interactively-p 'interactive)
577 (message "%s" str) 579 (message "%s" str)
578 str))) 580 str)))
diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index cbb61efc49e..b1c69ae7368 100644
--- a/lisp/tooltip.el
+++ b/lisp/tooltip.el
@@ -201,7 +201,8 @@ This might return nil if the event did not occur over a buffer."
201(defun tooltip-delay () 201(defun tooltip-delay ()
202 "Return the delay in seconds for the next tooltip." 202 "Return the delay in seconds for the next tooltip."
203 (if (and tooltip-hide-time 203 (if (and tooltip-hide-time
204 (< (- (float-time) tooltip-hide-time) tooltip-recent-seconds)) 204 (time-less-p (time-since tooltip-hide-time)
205 tooltip-recent-seconds))
205 tooltip-short-delay 206 tooltip-short-delay
206 tooltip-delay)) 207 tooltip-delay))
207 208
diff --git a/lisp/type-break.el b/lisp/type-break.el
index 9a8100fb0be..0ad79dd1130 100644
--- a/lisp/type-break.el
+++ b/lisp/type-break.el
@@ -460,8 +460,7 @@ the variable of the same name."
460 )))))) 460 ))))))
461 461
462(defun timep (time) 462(defun timep (time)
463 "If TIME is in the format returned by `current-time' then 463 "If TIME is a Lisp time value then return TIME, else return nil."
464return TIME, else return nil."
465 (condition-case nil 464 (condition-case nil
466 (and (float-time time) time) 465 (and (float-time time) time)
467 (error nil))) 466 (error nil)))
@@ -481,8 +480,7 @@ return TIME, else return nil."
481 480
482(defun type-break-get-previous-time () 481(defun type-break-get-previous-time ()
483 "Get previous break time from `type-break-file-name'. 482 "Get previous break time from `type-break-file-name'.
484Returns nil if the file is missing or if the time breaks with the 483Return nil if the file is missing or if the time is not a Lisp time value."
485`current-time' format."
486 (let ((file (type-break-choose-file))) 484 (let ((file (type-break-choose-file)))
487 (if file 485 (if file
488 (timep ;; returns expected format, else nil 486 (timep ;; returns expected format, else nil
@@ -808,7 +806,7 @@ this or ask the user to start one right now."
808 ((and (car type-break-keystroke-threshold) 806 ((and (car type-break-keystroke-threshold)
809 (< type-break-keystroke-count (car type-break-keystroke-threshold)))) 807 (< type-break-keystroke-count (car type-break-keystroke-threshold))))
810 ((> type-break-time-warning-count 0) 808 ((> type-break-time-warning-count 0)
811 (let ((timeleft (type-break-time-difference (current-time) 809 (let ((timeleft (type-break-time-difference nil
812 type-break-time-next-break))) 810 type-break-time-next-break)))
813 (setq type-break-warning-countdown-string (number-to-string timeleft)) 811 (setq type-break-warning-countdown-string (number-to-string timeleft))
814 (cond 812 (cond
@@ -905,8 +903,8 @@ Current keystroke count : %s"
905 (current-time-string type-break-time-next-break) 903 (current-time-string type-break-time-next-break)
906 (type-break-format-time 904 (type-break-format-time
907 (type-break-time-difference 905 (type-break-time-difference
908 (current-time) 906 nil
909 type-break-time-next-break))) 907 type-break-time-next-break)))
910 "none scheduled") 908 "none scheduled")
911 (or (car type-break-keystroke-threshold) "none") 909 (or (car type-break-keystroke-threshold) "none")
912 (or (cdr type-break-keystroke-threshold) "none") 910 (or (cdr type-break-keystroke-threshold) "none")
@@ -1090,7 +1088,7 @@ With optional non-nil ALL, force redisplay of all mode-lines."
1090 (erase-buffer) 1088 (erase-buffer)
1091 (setq elapsed (type-break-time-difference 1089 (setq elapsed (type-break-time-difference
1092 type-break-time-last-break 1090 type-break-time-last-break
1093 (current-time))) 1091 nil))
1094 (let ((good-interval (or type-break-good-rest-interval 1092 (let ((good-interval (or type-break-good-rest-interval
1095 type-break-good-break-interval))) 1093 type-break-good-break-interval)))
1096 (cond 1094 (cond
diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el
index a1cb0b9274e..b306082c3ba 100644
--- a/lisp/url/url-cache.el
+++ b/lisp/url/url-cache.el
@@ -205,7 +205,7 @@ If `url-standalone-mode' is non-nil, cached items never expire."
205 (time-less-p 205 (time-less-p
206 (time-add 206 (time-add
207 cache-time 207 cache-time
208 (encode-time (or expire-time url-cache-expire-time))) 208 (or expire-time url-cache-expire-time))
209 nil))))) 209 nil)))))
210 210
211(defun url-cache-prune-cache (&optional directory) 211(defun url-cache-prune-cache (&optional directory)
@@ -227,7 +227,7 @@ considered \"expired\"."
227 ((time-less-p 227 ((time-less-p
228 (time-add 228 (time-add
229 (file-attribute-modification-time (file-attributes file)) 229 (file-attribute-modification-time (file-attributes file))
230 (encode-time url-cache-expire-time)) 230 url-cache-expire-time)
231 now) 231 now)
232 (delete-file file) 232 (delete-file file)
233 (setq deleted-files (1+ deleted-files)))))) 233 (setq deleted-files (1+ deleted-files))))))
diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el
index 213dab268c9..31fc3e72664 100644
--- a/lisp/url/url-cookie.el
+++ b/lisp/url/url-cookie.el
@@ -105,11 +105,10 @@ i.e. 1970-1-1) are loaded as expiring one year from now instead."
105 ;; away, make it expire a year from now 105 ;; away, make it expire a year from now
106 (expires (format-time-string 106 (expires (format-time-string
107 "%d %b %Y %T [GMT]" 107 "%d %b %Y %T [GMT]"
108 (encode-time 108 (let ((s (string-to-number (nth 4 fields))))
109 (let ((s (string-to-number (nth 4 fields)))) 109 (if (and (zerop s) long-session)
110 (if (and (= s 0) long-session) 110 (time-add nil (* 365 24 60 60))
111 (encode-time (+ (* 365 24 60 60) (float-time))) 111 s))))
112 s)))))
113 (key (nth 5 fields)) 112 (key (nth 5 fields))
114 (val (nth 6 fields))) 113 (val (nth 6 fields)))
115 (cl-incf n) 114 (cl-incf n)
diff --git a/lisp/url/url-queue.el b/lisp/url/url-queue.el
index 6350081b1a3..9bf1bca238d 100644
--- a/lisp/url/url-queue.el
+++ b/lisp/url/url-queue.el
@@ -162,8 +162,8 @@ The variable `url-queue-timeout' sets a timeout."
162 (dolist (job url-queue) 162 (dolist (job url-queue)
163 ;; Kill jobs that have lasted longer than the timeout. 163 ;; Kill jobs that have lasted longer than the timeout.
164 (when (and (url-queue-start-time job) 164 (when (and (url-queue-start-time job)
165 (> (- (float-time) (url-queue-start-time job)) 165 (time-less-p url-queue-timeout
166 url-queue-timeout)) 166 (time-since (url-queue-start-time job))))
167 (push job dead-jobs))) 167 (push job dead-jobs)))
168 (dolist (job dead-jobs) 168 (dolist (job dead-jobs)
169 (url-queue-kill-job job) 169 (url-queue-kill-job job)
diff --git a/lisp/url/url.el b/lisp/url/url.el
index 101c2b2c541..ed0947795b0 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."
259 ;; process output. 259 ;; process output.
260 (while (and (not retrieval-done) 260 (while (and (not retrieval-done)
261 (or (not timeout) 261 (or (not timeout)
262 (< (float-time (time-subtract nil start-time)) 262 (time-less-p (time-since start-time) timeout)))
263 timeout)))
264 (url-debug 'retrieval 263 (url-debug 'retrieval
265 "Spinning in url-retrieve-synchronously: %S (%S)" 264 "Spinning in url-retrieve-synchronously: %S (%S)"
266 retrieval-done asynch-buffer) 265 retrieval-done asynch-buffer)
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index f9ea4def15b..c6806ba5cd4 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1541,10 +1541,7 @@ This command shares argument histories with \\[rgrep] and \\[grep]."
1541 "Create a stash with the current tree state." 1541 "Create a stash with the current tree state."
1542 (interactive) 1542 (interactive)
1543 (vc-git--call nil "stash" "save" 1543 (vc-git--call nil "stash" "save"
1544 (let ((ct (current-time))) 1544 (format-time-string "Snapshot on %Y-%m-%d at %H:%M"))
1545 (concat
1546 (format-time-string "Snapshot on %Y-%m-%d" ct)
1547 (format-time-string " at %H:%M" ct))))
1548 (vc-git-command "*vc-git-stash*" 0 nil "stash" "apply" "-q" "stash@{0}") 1545 (vc-git-command "*vc-git-stash*" 0 nil "stash" "apply" "-q" "stash@{0}")
1549 (vc-resynch-buffer (vc-git-root default-directory) t t)) 1546 (vc-resynch-buffer (vc-git-root default-directory) t t))
1550 1547
diff --git a/lisp/woman.el b/lisp/woman.el
index 110069335c8..38e083a961a 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -2011,7 +2011,7 @@ Optional argument REDRAW, if non-nil, forces mode line to be updated."
2011;; ;; Terminates man processing 2011;; ;; Terminates man processing
2012;; "Report formatting time." 2012;; "Report formatting time."
2013;; (message "Man formatting done in %s seconds" 2013;; (message "Man formatting done in %s seconds"
2014;; (float-time (time-subtract nil WoMan-Man-start-time)))) 2014;; (float-time (time-since WoMan-Man-start-time))))
2015 2015
2016 2016
2017;;; Buffer handling: 2017;;; Buffer handling:
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index 770aecfcbef..5ff718292d3 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -243,11 +243,10 @@ which is the \"1006\" extension implemented in Xterm >= 277."
243 (y (nth 2 click)) 243 (y (nth 2 click))
244 ;; Emulate timestamp information. This is accurate enough 244 ;; Emulate timestamp information. This is accurate enough
245 ;; for default value of mouse-1-click-follows-link (450msec). 245 ;; for default value of mouse-1-click-follows-link (450msec).
246 (timestamp (truncate 246 (timestamp (if (not xt-mouse-epoch)
247 (* 1000 247 (progn (setq xt-mouse-epoch (float-time)) 0)
248 (- (float-time) 248 (car (encode-time (time-since xt-mouse-epoch)
249 (or xt-mouse-epoch 249 1000))))
250 (setq xt-mouse-epoch (float-time)))))))
251 (w (window-at x y)) 250 (w (window-at x y))
252 (ltrb (window-edges w)) 251 (ltrb (window-edges w))
253 (left (nth 0 ltrb)) 252 (left (nth 0 ltrb))