emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r104932: Merge: timer.el: Use time-da


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104932: Merge: timer.el: Use time-date fns rather than rolling our own.
Date: Sun, 03 Jul 2011 23:31:40 -0700
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104932 [merge]
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2011-07-03 23:31:40 -0700
message:
  Merge: timer.el: Use time-date fns rather than rolling our own.
  
  This is simpler and helps future-proof the code.
  * emacs-lisp/timer.el (timer-until): Use time-subtract and float-time.
  (timer--time-less-p): Use time-less-p.
modified:
  lisp/ChangeLog
  lisp/emacs-lisp/timer.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-07-04 01:06:33 +0000
+++ b/lisp/ChangeLog    2011-07-04 06:31:40 +0000
@@ -1,3 +1,10 @@
+2011-07-04  Paul Eggert  <address@hidden>
+
+       * emacs-lisp/timer.el: Use time-date fns rather than rolling our own.
+       This is simpler and helps future-proof the code.
+       (timer-until): Use time-subtract and float-time.
+       (timer--time-less-p): Use time-less-p.
+
 2011-07-04  Juanma Barranquero  <address@hidden>
 
        * type-break.el (timep): Use the value of `float-time' to avoid a

=== modified file 'lisp/emacs-lisp/timer.el'
--- a/lisp/emacs-lisp/timer.el  2011-07-01 01:27:40 +0000
+++ b/lisp/emacs-lisp/timer.el  2011-07-04 06:25:23 +0000
@@ -119,14 +119,7 @@
 
 (defun timer--time-less-p (t1 t2)
   "Say whether time value T1 is less than time value T2."
-  ;; FIXME just use time-less-p.
-  (destructuring-bind (high1 low1 micro1) (timer--time t1)
-    (destructuring-bind (high2 low2 micro2) (timer--time t2)
-      (or (< high1 high2)
-          (and (= high1 high2)
-               (or (< low1 low2)
-                   (and (= low1 low2)
-                        (< micro1 micro2))))))))
+  (time-less-p (timer--time t1) (timer--time t2)))
 
 (defun timer-inc-time (timer secs &optional usecs)
   "Increment the time set in TIMER by SECS seconds and USECS microseconds.
@@ -258,10 +251,7 @@
   "Calculate number of seconds from when TIMER will run, until TIME.
 TIMER is a timer, and stands for the time when its next repeat is scheduled.
 TIME is a time-list."
-  ;; FIXME: (float-time (time-subtract (timer--time timer) time))
-  (let ((high (- (car time) (timer--high-seconds timer)))
-       (low (- (nth 1 time) (timer--low-seconds timer))))
-    (+ low (* high 65536))))
+  (float-time (time-subtract time (timer--time timer))))
 
 (defun timer-event-handler (timer)
   "Call the handler for the timer TIMER.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]