]> git.eshelyaron.com Git - emacs.git/commitdiff
Don’t assume CURRENT_TIME_LIST
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 13 Feb 2019 08:50:19 +0000 (00:50 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 13 Feb 2019 08:51:15 +0000 (00:51 -0800)
* lisp/progmodes/cc-cmds.el (c-progress-init)
(c-progress-update):
* lisp/progmodes/cperl-mode.el (cperl-time-fontification):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
Don’t assume (current-time) returns a list.
Fix unlikely bug if we’re called 65536 seconds apart.

lisp/progmodes/cc-cmds.el
lisp/progmodes/cperl-mode.el
lisp/progmodes/vhdl-mode.el

index c0a688195ca39c630a594caa8542086b580e195b..efc6747de48b891075e9fe2c1ce440610540d9ea 100644 (file)
@@ -3609,7 +3609,7 @@ Otherwise reindent just the current line."
                                    (save-excursion
                                      (goto-char end)
                                      (point-marker))
-                                   (nth 1 (current-time))
+                                   (encode-time nil 'integer)
                                    context))
       (message "Indenting region..."))
    ))
@@ -3617,7 +3617,7 @@ Otherwise reindent just the current line."
 (defun c-progress-update ()
   (if (not (and c-progress-info c-progress-interval))
       nil
-    (let ((now (nth 1 (current-time)))
+    (let ((now (encode-time nil 'integer))
          (start (aref c-progress-info 0))
          (end (aref c-progress-info 1))
          (lastsecs (aref c-progress-info 2)))
index b83947f90344970f24a8d134c22d7ffa30683a90..cb69a43b63f82616501432eb74f73704fa9077c6 100644 (file)
@@ -8675,9 +8675,7 @@ start with default arguments, then refine the slowdown regions."
   (or l (setq l 1))
   (or step (setq step 500))
   (or lim (setq lim 40))
-  (let* ((timems (function (lambda ()
-                            (let ((tt (current-time)))
-                              (+ (* 1000 (nth 1 tt)) (/ (nth 2 tt) 1000))))))
+  (let* ((timems (function (lambda () (car (encode-time nil 1000)))))
         (tt (funcall timems)) (c 0) delta tot)
     (goto-char (point-min))
     (forward-line (1- l))
index 3bcf9e50f05f021dbb7bc63c296380f1817ae8d0..27380b33adb68e03dbf4d4078d5a8a6b18a20cd4 100644 (file)
@@ -7392,8 +7392,8 @@ only-lines."
 (defun vhdl-update-progress-info (string pos)
   "Update progress information."
   (when (and vhdl-progress-info (not noninteractive)
-            (< vhdl-progress-interval
-               (- (nth 1 (current-time)) (aref vhdl-progress-info 2))))
+            (time-less-p vhdl-progress-interval
+                         (time-subtract nil (aref vhdl-progress-info 2))))
     (let ((delta (- (aref vhdl-progress-info 1)
                     (aref vhdl-progress-info 0))))
       (message "%s... (%2d%%)" string
@@ -7401,7 +7401,7 @@ only-lines."
                   100
                  (floor (* 100.0 (- pos (aref vhdl-progress-info 0)))
                         delta))))
-    (aset vhdl-progress-info 2 (nth 1 (current-time)))))
+    (aset vhdl-progress-info 2 (encode-time nil 'integer))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Indentation commands
@@ -8142,12 +8142,12 @@ depending on parameter UPPER-CASE."
                 (upcase-word -1)
               (downcase-word -1)))
         (when (and count vhdl-progress-interval (not noninteractive)
-                   (< vhdl-progress-interval
-                      (- (nth 1 (current-time)) last-update)))
+                   (time-less-p vhdl-progress-interval
+                                (time-subtract nil last-update)))
           (message "Fixing case... (%2d%s)"
                    (+ (* count 20) (/ (* 20 (- (point) beg)) (- end beg)))
                    "%")
-          (setq last-update (nth 1 (current-time)))))
+          (setq last-update (encode-time nil 'integer))))
        (goto-char end)))))
 
 (defun vhdl-fix-case-region (beg end &optional arg)