From f8a1023408264cfdec0b568b7d14084f4f60abfd Mon Sep 17 00:00:00 2001 From: Andrew Innes Date: Sun, 2 May 1999 09:40:45 +0000 Subject: [PATCH] (ls-lisp-format-time): Trap errors from format-time-string, and return a suitable string to indicate the timestamp was invalid. --- lisp/ls-lisp.el | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el index a498c07321f..f52bdef4b0a 100644 --- a/lisp/ls-lisp.el +++ b/lisp/ls-lisp.el @@ -302,15 +302,17 @@ are: A a c i r S s t u" (diff (+ (ash diff16 16) (- (car (cdr time)) (car (cdr now))))) (past-cutoff (- (* 6 30 24 60 60))) ; 6 30-day months (future-cutoff (* 60 60))) ; 1 hour - (format-time-string - (if (and - (<= past-cutoff diff) (<= diff future-cutoff) - ;; Sanity check in case `diff' computation overflowed. - (<= (1- (ash past-cutoff -16)) diff16) - (<= diff16 (1+ (ash future-cutoff -16)))) - "%b %e %H:%M" - "%b %e %Y") - time))) + (condition-case nil + (format-time-string + (if (and + (<= past-cutoff diff) (<= diff future-cutoff) + ;; Sanity check in case `diff' computation overflowed. + (<= (1- (ash past-cutoff -16)) diff16) + (<= diff16 (1+ (ash future-cutoff -16)))) + "%b %e %H:%M" + "%b %e %Y") + time) + (error "??? ?? ????")))) (provide 'ls-lisp) -- 2.39.2