Function: magit--age

magit--age is a byte-compiled function defined in magit-margin.el.

Signature

(magit--age DATE &optional ABBREVIATE)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-margin.el
(defun magit--age (date &optional abbreviate)
  (named-let calc ((age (abs (- (float-time)
                                (if (stringp date)
                                    (string-to-number date)
                                  date))))
                   (spec magit--age-spec))
    (pcase-let* ((`((,char ,unit ,units ,weight) . ,spec) spec)
                 (cnt (round (/ age weight 1.0))))
      (if (or (not spec)
              (>= (/ age weight) 1))
          (list cnt (cond (abbreviate char)
                          ((= cnt 1) unit)
                          (units)))
        (calc age spec)))))