diff options
author | Katsumi Yamaoka <yamaoka@jpl.org> | 2009-09-09 09:29:29 +0000 |
---|---|---|
committer | Katsumi Yamaoka <yamaoka@jpl.org> | 2009-09-09 09:29:29 +0000 |
commit | cdce0b331faad4c64ae4b3015318db87499a1f92 (patch) | |
tree | bbac90dfcbdc7a9772a30d739e116f10b8b27973 /lisp/calendar/time-date.el | |
parent | de0bdfe7aa97030b6174aba37f245c2bbf2d4ee5 (diff) | |
download | emacs-cdce0b331faad4c64ae4b3015318db87499a1f92.tar.gz |
* calendar/time-date.el (autoload):
Expand define-obsolete-function-alias into defalias and make-obsolete
for old Emacsen that Gnus supports.
(with-no-warnings): Define it for old Emacsen.
(time-to-seconds): Don't use (featurep 'xemacs) to check if float-time
is available.
(time-to-number-of-days): Don't use (featurep 'xemacs) to check if
float-time is available; suppress compile warning for time-to-seconds.
2009-09-09 Teodor Zlatanov <tzz@lifelogs.com>
* net/imap.el (imap-message-map): Docstring fix.
Diffstat (limited to 'lisp/calendar/time-date.el')
-rw-r--r-- | lisp/calendar/time-date.el | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el index 4521398d2d4..ec0c8dc8bee 100644 --- a/lisp/calendar/time-date.el +++ b/lisp/calendar/time-date.el @@ -114,17 +114,27 @@ and type 2 is the list (HIGH LOW MICRO)." ;; Bit of a mess. Emacs has float-time since at least 21.1. ;; This file is synced to Gnus, and XEmacs packages may have been written ;; using time-to-seconds from the Gnus library. -;;;###autoload(if (featurep 'xemacs) -;;;###autoload (autoload 'time-to-seconds "time-date") -;;;###autoload (define-obsolete-function-alias 'time-to-seconds 'float-time "21.1")) - -(if (featurep 'xemacs) +;;;###autoload(if (and (fboundp 'float-time) +;;;###autoload (subrp (symbol-function 'float-time))) +;;;###autoload (progn +;;;###autoload (defalias 'time-to-seconds 'float-time) +;;;###autoload (make-obsolete 'time-to-seconds 'float-time "21.1")) +;;;###autoload (autoload 'time-to-seconds "time-date")) + +(eval-and-compile + (unless (and (fboundp 'float-time) + (subrp (symbol-function 'float-time))) (defun time-to-seconds (time) "Convert time value TIME to a floating point number." (with-decoded-time-value ((high low micro time)) - (+ (* 1.0 high 65536) - low - (/ micro 1000000.0))))) + (+ (* 1.0 high 65536) + low + (/ micro 1000000.0)))))) + +(eval-when-compile + (unless (fboundp 'with-no-warnings) + (defmacro with-no-warnings (&rest body) + `(progn ,@body)))) ;;;###autoload (defun seconds-to-time (seconds) @@ -248,12 +258,17 @@ The Gregorian date Sunday, December 31, 1bce is imaginary." (- (/ (1- year) 100)) ; - century years (/ (1- year) 400)))) ; + Gregorian leap years -(defun time-to-number-of-days (time) - "Return the number of days represented by TIME. +(eval-and-compile + (if (and (fboundp 'float-time) + (subrp (symbol-function 'float-time))) + (defun time-to-number-of-days (time) + "Return the number of days represented by TIME. +The number of days will be returned as a floating point number." + (/ (float-time time) (* 60 60 24))) + (defun time-to-number-of-days (time) + "Return the number of days represented by TIME. The number of days will be returned as a floating point number." - (/ (if (featurep 'xemacs) - (time-to-seconds time) - (float-time time)) (* 60 60 24))) + (/ (with-no-warnings (time-to-seconds time)) (* 60 60 24))))) ;;;###autoload (defun safe-date-to-time (date) |