summaryrefslogtreecommitdiff
path: root/lisp/gnus
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-02-22 18:32:31 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2019-02-22 18:33:57 -0800
commit476066e89d6f0bb87220da690b8a476bf9655b80 (patch)
tree5b79293c40ba0f54544d803a02fbec7310f04a0e /lisp/gnus
parenteba66c1eafeef6512259c9b46face2b03c7433b8 (diff)
downloademacs-476066e89d6f0bb87220da690b8a476bf9655b80.tar.gz
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.
Diffstat (limited to 'lisp/gnus')
-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
13 files changed, 32 insertions, 32 deletions
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."
(defun article-lapsed-string (time &optional max-segments)
;; If the date is seriously mangled, the timezone functions are
;; liable to bug out, so we ignore all errors.
- (let* ((real-time (time-subtract nil time))
+ (let* ((real-time (time-since time))
(real-sec (float-time real-time))
(sec (abs real-sec))
(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."
(defun gnus-demon-idle-since ()
"Return the number of seconds since when Emacs is idle."
- (float-time (or (current-idle-time) '(0 0 0))))
+ (float-time (or (current-idle-time) 0)))
(defun gnus-demon-run-callback (func &optional idle time special)
"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'."
;; FIXME: This should return a Lisp integer, not a Lisp float,
;; since it is always an integer.
(let* ((time (or (gnus-group-timestamp group) 0))
- (delta (time-subtract nil time)))
+ (delta (time-since time)))
(float-time delta)))
(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."
(end-time (format-time-string "%H:%M" end))
(end-at-midnight (string= end-time "00:00"))
(start-end-date-diff
- (/ (float-time (time-subtract
- (org-time-string-to-time end-date)
- (org-time-string-to-time start-date)))
- 86400))
+ (time-to-number-of-days (time-subtract
+ (org-time-string-to-time end-date)
+ (org-time-string-to-time start-date))))
(org-repeat (gnus-icalendar-event:org-repeat event))
(repeat (if org-repeat (concat " " org-repeat) ""))
- (time-1-day '(0 86400)))
+ (time-1-day 86400))
;; NOTE: special care is needed with appointments ending at midnight
;; (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)."
(insert (format-time-string "%H:%M:%S")
(format " %.2fs %s %S\n"
(if (numberp gnus-backend-trace-elapsed)
- (- (float-time) gnus-backend-trace-elapsed)
+ (float-time
+ (time-since gnus-backend-trace-elapsed))
0)
type form))
(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."
(when (and gnus-summary-default-score
scores)
(let* ((entries gnus-header-index)
- (now (time-to-days (current-time)))
+ (now (time-to-days nil))
(expire (and gnus-score-expiry-days
(- now gnus-score-expiry-days)))
(headers gnus-newsgroup-headers)
@@ -2380,7 +2380,7 @@ score in `gnus-newsgroup-scored' by SCORE."
(memq 'word gnus-newsgroup-adaptive))
(with-temp-buffer
(let* ((hashtb (gnus-make-hashtable 1000))
- (date (time-to-days (current-time)))
+ (date (time-to-days nil))
(data gnus-newsgroup-data)
word d score val)
(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."
Returns \" ? \" if there's bad input or if another error occurs.
Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"."
(condition-case ()
- (let* ((messy-date (float-time (gnus-date-get-time messy-date)))
- (now (float-time))
+ (let* ((messy-date (gnus-date-get-time messy-date))
+ (now (current-time))
;;If we don't find something suitable we'll use this one
(my-format "%b %d '%y"))
- (let* ((difference (- now messy-date))
+ (let* ((difference (time-subtract now messy-date))
(templist gnus-user-date-format-alist)
(top (eval (caar templist))))
- (while (if (numberp top) (< top difference) (not top))
+ (while (if (numberp top) (time-less-p top difference) (not top))
(progn
(setq templist (cdr templist))
(setq top (eval (caar templist)))))
(if (stringp (cdr (car templist)))
(setq my-format (cdr (car templist)))))
- (format-time-string (eval my-format) (encode-time messy-date)))
+ (format-time-string (eval my-format) messy-date))
(error " ? ")))
(defun gnus-summary-set-local-parameters (group)
@@ -5093,8 +5093,8 @@ Unscored articles will be counted as having a score of zero."
"Return the highest article date in THREAD."
(apply 'max
(mapcar (lambda (header) (float-time
- (gnus-date-get-time
- (mail-header-date header))))
+ (gnus-date-get-time
+ (mail-header-date header))))
(flatten-tree thread))))
(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)
;; Don't check for old incoming files more than once per day to
;; save a lot of file accesses.
(when (or (null mail-source-incoming-last-checked-time)
- (> (float-time
- (time-since mail-source-incoming-last-checked-time))
- (* 24 60 60)))
+ (time-less-p
+ (* 24 60 60)
+ (time-since mail-source-incoming-last-checked-time)))
(setq mail-source-incoming-last-checked-time (current-time))
(mail-source-delete-old-incoming
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.")
"Subject: " (file-name-nondirectory file) (or extra-msg "") "\n"
"Message-ID: <nneething-" (nneething-encode-file-name file)
"@" (system-name) ">\n"
- (if (zerop (float-time (file-attribute-modification-time atts))) ""
+ (if (time-equal-p 0 (file-attribute-modification-time atts)) ""
(concat "Date: "
(current-time-string (file-attribute-modification-time atts))
"\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."
(defvar nnheader-last-message-time '(0 0))
(defun nnheader-message-maybe (&rest args)
(let ((now (current-time)))
- (when (> (float-time (time-subtract now nnheader-last-message-time)) 1)
+ (when (time-less-p 1 (time-subtract now nnheader-last-message-time))
(setq nnheader-last-message-time now)
(apply 'nnheader-message args))))
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.")
(with-current-buffer buffer
(when (and nnimap-object
(nnimap-last-command-time nnimap-object)
- (> (float-time
- (time-subtract
- now
- (nnimap-last-command-time nnimap-object)))
- ;; More than five minutes since the last command.
- (* 5 60)))
+ (time-less-p
+ ;; More than five minutes since the last command.
+ (* 5 60)
+ (time-subtract
+ now
+ (nnimap-last-command-time nnimap-object))))
(ignore-errors ;E.g. "buffer foo has no process".
(nnimap-send-command "NOOP"))))))))
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."
(setq days (days-to-time days))
;; Compare the time with the current time.
(if (null time)
- (time-subtract nil days)
+ (time-since days)
(ignore-errors (time-less-p days (time-since time)))))))))
(declare-function gnus-group-mark-article-read "gnus-group" (group article))
diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el
index 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'.")
(defun nnmaildir--scan (gname scan-msgs groups _method srv-dir srv-ls)
(catch 'return
- (let ((36h-ago (- (float-time) 129600))
+ (let ((36h-ago (time-since 129600))
absdir nndir tdir ndir cdir nattr cattr isnew pgname read-only ls
files num dir flist group x)
(setq absdir (nnmaildir--srvgrp-dir srv-dir gname)
@@ -1577,7 +1577,7 @@ This variable is set by `nnmaildir-request-article'.")
(when no-force
(unless (integerp time) ;; handle 'never
(throw 'return (gnus-uncompress-range ranges)))
- (setq boundary (time-subtract nil time)))
+ (setq boundary (time-since time)))
(setq dir (nnmaildir--srv-dir nnmaildir--cur-server)
dir (nnmaildir--srvgrp-dir dir gname)
dir (nnmaildir--cur dir)