Function: find-lisp-format-time

find-lisp-format-time is a byte-compiled function defined in find-lisp.el.gz.

Signature

(find-lisp-format-time FILE-ATTR SWITCHES NOW)

Documentation

Format time string for file.

This is done with attributes FILE-ATTR according to SWITCHES (a list of ls option letters of which c and u are recognized). Use the same method as "ls" to decide whether to show time-of-day or year, depending on distance between file date and NOW.

Source Code

;; Defined in /usr/src/emacs/lisp/find-lisp.el.gz
(defun find-lisp-format-time (file-attr switches now)
  "Format time string for file.
This is done with attributes FILE-ATTR according to SWITCHES (a
list of ls option letters of which c and u are recognized).  Use
the same method as \"ls\" to decide whether to show time-of-day or
year, depending on distance between file date and NOW."
  (let* ((time (nth (find-lisp-time-index switches) file-attr))
	 (diff (time-convert (time-subtract time now) 'integer))
	 (past-cutoff -15778476)		; 1/2 of a Gregorian year
	 (future-cutoff (* 60 60)))		; 1 hour
    (format-time-string
     (if (<= past-cutoff diff future-cutoff)
	 "%b %e %H:%M"
       "%b %e  %Y")
     time)))