]> code.delx.au - gnu-emacs/blobdiff - lisp/calendar/time-date.el
Merge from emacs-24; up to 2014-07-21T01:34:03Z!monnier@iro.umontreal.ca
[gnu-emacs] / lisp / calendar / time-date.el
index b04cfcd9fe41ac21d9619d1e0861d6ee0bfecb76..48fe2294354a1468be3f085641cc67ff5b3e60f3 100644 (file)
@@ -119,13 +119,20 @@ it is assumed that PICO was omitted and should be treated as zero."
 (defun date-to-time (date)
   "Parse a string DATE that represents a date-time and return a time value.
 If DATE lacks timezone information, GMT is assumed."
-  (condition-case ()
+  (condition-case err
       (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))))))
+    (error
+     (let ((overflow-error '(error "Specified time is not representable")))
+       (if (equal err overflow-error)
+          (apply 'signal err)
+        (condition-case err
+            (apply 'encode-time
+                   (parse-time-string
+                    (timezone-make-date-arpa-standard date)))
+          (error
+           (if (equal err overflow-error)
+               (apply 'signal err)
+             (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