[gnus git] branch master updated: m0-11-83-gae2d1ae =1= time-date.el: Port new time stamp handling to old Emacs and to XEmacs
Katsumi <[email protected]> Mon, 17 Nov 2014 09:59:43 +0100
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via ae2d1aecc8790a70970b22501eb342150d1f1f6e (commit)
from 147f091b675f6c4caca95707cb7bd1519c9e7a2d (commit)
- Log -----------------------------------------------------------------
commit ae2d1aecc8790a70970b22501eb342150d1f1f6e
Author: Paul Eggert <[email protected]>
Date: Mon Nov 17 08:59:40 2014 +0000
time-date.el: Port new time stamp handling to old Emacs and to XEmacs
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b6dbedc..83f87d3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -5,13 +5,21 @@
2014-11-17 Paul Eggert <[email protected]>
+ Port new time stamp handling to old Emacs and to XEmacs.
+ This is needed for Gnus, which copies time-date.el and which
+ runs on older Emacs implementations.
+ * time-date.el (with-decoded-time-value):
+ Handle 'nil' and floating-point arg more compatibly with new Emacs.
+ (encode-time-value, with-decoded-time-value):
+ Obsolete only if new Emacs.
+ (time-add, time-subtract, time-less-p): Define if not new Emacs.
+
Improve time stamp handling, and be more consistent about it.
This implements a suggestion made in:
http://lists.gnu.org/archive/html/emacs-devel/2014-10/msg00587.html
Among other things, this means timer.el no longer needs to
autoload the time-date module.
- * time-date.el (seconds-to-time, days-to-time, time-since):
- Simplify by using new functionality.
+ * time-date.el (seconds-to-time, days-to-time, time-since)
(with-decoded-time-value):
Treat 'nil' as current time. This is mostly for XEmacs.
(encode-time-value, with-decoded-time-value): Obsolete.
diff --git a/lisp/time-date.el b/lisp/time-date.el
index 100e856..a9c30f4 100644
--- a/lisp/time-date.el
+++ b/lisp/time-date.el
@@ -65,12 +65,36 @@ list (HIGH LOW MICRO PICO)."
(pop elt)))
(time-value (car elt))
(gensym (make-symbol "time")))
- `(let* ,(append `((,gensym ,time-value)
+ `(let* ,(append `((,gensym (or ,time-value (current-time)))
+ (,gensym
+ (cond
+ ((integerp ,gensym)
+ (list (ash ,gensym -16)
+ (logand ,gensym 65535)))
+ ((floatp ,gensym)
+ (let* ((usec (* 1000000 (mod ,gensym 1)))
+ (ps (round (* 1000000 (mod usec 1))))
+ (us (floor usec))
+ (lo (floor (mod ,gensym 65536)))
+ (hi (floor ,gensym 65536)))
+ (if (eq ps 1000000)
+ (progn
+ (setq ps 0)
+ (setq us (1+ us))
+ (if (eq us 1000000)
+ (progn
+ (setq us 0)
+ (setq lo (1+ lo))
+ (if (eq lo 65536)
+ (progn
+ (setq lo 0)
+ (setq hi (1+ hi))))))))
+ (list hi lo us ps)))
+ (t ,gensym)))
(,high (pop ,gensym))
,low ,micro)
(when pico `(,pico))
(when type `(,type)))
- (or ,gensym (setq ,gensym (current-time)))
(if (consp ,gensym)
(progn
(setq ,low (pop ,gensym))
@@ -108,7 +132,7 @@ it is assumed that PICO was omitted and should be treated as zero."
((eq type 3) (list high low micro pico))
((null type) (encode-time-value high low micro 0 pico))))
-(when (featurep 'emacs)
+(when (and (fboundp 'time-add) (subrp (symbol-function 'time-add)))
(make-obsolete 'encode-time-value nil "25.1")
(make-obsolete 'with-decoded-time-value nil "25.1"))
@@ -192,7 +216,7 @@ TIME should be either a time value or a date-time string."
;;;###autoload(autoload 'time-less-p "time-date")
(eval-when-compile
- (when (not (featurep 'emacs))
+ (when (not (and (fboundp 'time-add) (subrp (symbol-function 'time-add))))
(defun time-add (t1 t2)
"Add two time values T1 and T2. One should represent a time difference."
-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.
Summary of changes:
lisp/ChangeLog | 12 ++++++++++--
lisp/time-date.el | 32 ++++++++++++++++++++++++++++----
2 files changed, 38 insertions(+), 6 deletions(-)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".
The branch, master has been updated
hooks/post-receive
--
Gnus Project