diff options
Diffstat (limited to 'lisp/calendar')
-rw-r--r-- | lisp/calendar/parse-time.el | 2 | ||||
-rw-r--r-- | lisp/calendar/time-date.el | 19 |
2 files changed, 14 insertions, 7 deletions
diff --git a/lisp/calendar/parse-time.el b/lisp/calendar/parse-time.el index 6bfccec94c6..6c88210030b 100644 --- a/lisp/calendar/parse-time.el +++ b/lisp/calendar/parse-time.el @@ -131,7 +131,7 @@ `(((6) parse-time-weekdays) ((3) (1 31)) ((4) parse-time-months) - ((5) (100 4038)) + ((5) (100 ,most-positive-fixnum)) ((2 1 0) ,#'(lambda () (and (stringp parse-time-elt) (= (length parse-time-elt) 8) diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el index b04cfcd9fe4..48fe2294354 100644 --- a/lisp/calendar/time-date.el +++ b/lisp/calendar/time-date.el @@ -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 |