aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Innes1999-05-02 09:40:45 +0000
committerAndrew Innes1999-05-02 09:40:45 +0000
commitf8a1023408264cfdec0b568b7d14084f4f60abfd (patch)
treebe4d30a18d50332b4ca507a95e9e42970f454f6f
parent7e3a77161ef2c49d8cd74f82066095cfade73ee9 (diff)
downloademacs-f8a1023408264cfdec0b568b7d14084f4f60abfd.tar.gz
emacs-f8a1023408264cfdec0b568b7d14084f4f60abfd.zip
(ls-lisp-format-time): Trap errors from
format-time-string, and return a suitable string to indicate the timestamp was invalid.
-rw-r--r--lisp/ls-lisp.el20
1 files 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"
302 (diff (+ (ash diff16 16) (- (car (cdr time)) (car (cdr now))))) 302 (diff (+ (ash diff16 16) (- (car (cdr time)) (car (cdr now)))))
303 (past-cutoff (- (* 6 30 24 60 60))) ; 6 30-day months 303 (past-cutoff (- (* 6 30 24 60 60))) ; 6 30-day months
304 (future-cutoff (* 60 60))) ; 1 hour 304 (future-cutoff (* 60 60))) ; 1 hour
305 (format-time-string 305 (condition-case nil
306 (if (and 306 (format-time-string
307 (<= past-cutoff diff) (<= diff future-cutoff) 307 (if (and
308 ;; Sanity check in case `diff' computation overflowed. 308 (<= past-cutoff diff) (<= diff future-cutoff)
309 (<= (1- (ash past-cutoff -16)) diff16) 309 ;; Sanity check in case `diff' computation overflowed.
310 (<= diff16 (1+ (ash future-cutoff -16)))) 310 (<= (1- (ash past-cutoff -16)) diff16)
311 "%b %e %H:%M" 311 (<= diff16 (1+ (ash future-cutoff -16))))
312 "%b %e %Y") 312 "%b %e %H:%M"
313 time))) 313 "%b %e %Y")
314 time)
315 (error "??? ?? ????"))))
314 316
315(provide 'ls-lisp) 317(provide 'ls-lisp)
316 318