[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r104923: * type-break.el: Accept time
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r104923: * type-break.el: Accept time formats that the builtins accept. |
Date: |
Sun, 03 Jul 2011 16:51:42 -0700 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 104923
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2011-07-03 16:51:42 -0700
message:
* type-break.el: Accept time formats that the builtins accept.
(timep, type-break-time-difference): Accept any format that
float-time accepts, rather than insisting on (HIGH LOW USECS) format.
This is simpler and helps future-proof the code.
(type-break-time-difference): Round rather than ignoring
subseconds components.
modified:
lisp/ChangeLog
lisp/type-break.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-07-03 22:43:50 +0000
+++ b/lisp/ChangeLog 2011-07-03 23:51:42 +0000
@@ -1,3 +1,12 @@
+2011-07-03 Paul Eggert <address@hidden>
+
+ * type-break.el: Accept time formats that the builtins accept.
+ (timep, type-break-time-difference): Accept any format that
+ float-time accepts, rather than insisting on (HIGH LOW USECS) format.
+ This is simpler and helps future-proof the code.
+ (type-break-time-difference): Round rather than ignoring
+ subseconds components.
+
2011-07-03 Lars Magne Ingebrigtsen <address@hidden>
* info.el (Info-apropos-matches): Make non-interactive, since it
=== modified file 'lisp/type-break.el'
--- a/lisp/type-break.el 2011-07-01 18:21:09 +0000
+++ b/lisp/type-break.el 2011-07-03 23:51:42 +0000
@@ -47,7 +47,7 @@
;; or set the variable of the same name to `t'.
;; This program can truly cons up a storm because of all the calls to
-;; `current-time' (which always returns 3 fresh conses). I'm dismayed by
+;; `current-time' (which always returns fresh conses). I'm dismayed by
;; this, but I think the health of my hands is far more important than a
;; few pages of virtual memory.
@@ -501,12 +501,9 @@
(defun timep (time)
"If TIME is in the format returned by `current-time' then
return TIME, else return nil."
- (and (listp time)
- (eq (length time) 3)
- (integerp (car time))
- (integerp (nth 1 time))
- (integerp (nth 2 time))
- time))
+ (condition-case nil
+ (progn (float-time time) time)
+ (error nil)))
(defun type-break-choose-file ()
"Return file to read from."
@@ -993,12 +990,8 @@
;; Compute the difference, in seconds, between a and b, two structures
;; similar to those returned by `current-time'.
-;; Use addition rather than logand since that is more robust; the low 16
-;; bits of the seconds might have been incremented, making it more than 16
-;; bits wide.
(defun type-break-time-difference (a b)
- (+ (lsh (- (car b) (car a)) 16)
- (- (car (cdr b)) (car (cdr a)))))
+ (round (float-time (time-subtract b a))))
;; Return (in a new list the same in structure to that returned by
;; `current-time') the sum of the arguments. Each argument may be a time
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r104923: * type-break.el: Accept time formats that the builtins accept.,
Paul Eggert <=