Simplify nnspool-request-newgroups arithmetic

* lisp/gnus/nnspool.el (nnspool-request-newgroups):
Simplify by compute time stamps as integers, not floats,
since integers don’t overflow any more.
This commit is contained in:
Paul Eggert 2019-02-12 18:24:59 -08:00
parent 21eef9fa7f
commit 7ee12d95fb

View file

@ -305,25 +305,18 @@ there.")
(while (and (not (looking-at
"\\([^ ]+\\) +\\([0-9]+\\)[0-9][0-9][0-9] "))
(zerop (forward-line -1))))
;; We require nnheader which requires gnus-util.
(let ((seconds (float-time (date-to-time date)))
(let ((seconds (encode-time (date-to-time date) 'integer))
groups)
;; Go through lines and add the latest groups to a list.
(while (and (looking-at "\\([^ ]+\\) +[0-9]+ ")
(progn
;; We insert a .0 to make the list reader
;; interpret the number as a float. It is far
;; too big to be stored in a lisp integer.
(goto-char (1- (match-end 0)))
(insert ".0")
(> (progn
(goto-char (match-end 1))
(read (current-buffer)))
seconds))
(push (buffer-substring
(match-beginning 1) (match-end 1))
groups)
(zerop (forward-line -1))))
(goto-char (match-end 1))
(< seconds (read (current-buffer))))
(progn
(push (buffer-substring
(match-beginning 1) (match-end 1))
groups)
(zerop (forward-line -1)))))
(erase-buffer)
(dolist (group groups)
(insert group " 0 0 y\n")))