]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix org-timer-show-remaining-time > 1 hour
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 18 Aug 2019 00:19:13 +0000 (17:19 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 18 Aug 2019 00:22:25 +0000 (17:22 -0700)
* lisp/org/org-timer.el (org-timer-show-remaining-time):
Don’t assume the remaining time is less than one hour.
Simplify.  The simplification removes the need for a
decode-time, and fixes a typo I introduced recently.

lisp/org/org-timer.el

index 20b33a1ef5f40ba60191798ec3f18e33d0803715..e1bbfa97093c1c29b0729d2a07ac9d2abffcb4be 100644 (file)
@@ -380,17 +380,12 @@ VALUE can be `on', `off', or `paused'."
 (defun org-timer-show-remaining-time ()
   "Display the remaining time before the timer ends."
   (interactive)
-  (require 'time)
-  (if (not org-timer-countdown-timer)
-      (message "No timer set")
-    (let* ((rtime (decode-time
-                  (time-subtract (timer--time org-timer-countdown-timer)
-                                 nil)
-                  'integer))
-          (rsecs (nth 0 rtime))
-          (rmins (nth 1 rtime)))
-      (message "%d minute(s) %d seconds left before next time out"
-              rmins rsecs))))
+  (message
+   (if (not org-timer-countdown-timer)
+       "No timer set"
+     (format-seconds
+      "%m minute(s) %s seconds left before next time out"
+      (time-subtract (timer--time org-timer-countdown-timer) nil)))))
 
 ;;;###autoload
 (defun org-timer-set-timer (&optional opt)