- (apply 'encode-time
- (parse-time-string
- ;; `parse-time-string' isn't sufficiently general or
- ;; robust. It fails to grok some of the formats that
- ;; timezone does (e.g. dodgy post-2000 stuff from some
- ;; Elms) and either fails or returns bogus values. Lars
- ;; reverted this change, but that loses non-trivially
- ;; often for me. -- fx
- (timezone-make-date-arpa-standard date)))
- (error (error "Invalid date: %s" date))))
-
-;;;###autoload
-(defun time-to-seconds (time)
- "Convert time value TIME to a floating point number.
-You can use `float-time' instead."
- (with-decoded-time-value ((high low micro time))
- (+ (* 1.0 high 65536)
- low
- (/ micro 1000000.0))))
+ (apply 'encode-time (parse-time-string date))
+ (error (condition-case ()
+ (apply 'encode-time
+ (parse-time-string
+ (timezone-make-date-arpa-standard date)))
+ (error (error "Invalid date: %s" date))))))
+
+;; 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 (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))))))
+
+(eval-when-compile
+ (unless (fboundp 'with-no-warnings)
+ (defmacro with-no-warnings (&rest body)
+ `(progn ,@body))))