Function: mpc-secs-to-time
mpc-secs-to-time is a byte-compiled function defined in mpc.el.gz.
Signature
(mpc-secs-to-time SECS)
Documentation
Convert SECS from a string, integer or float value to a time string.
Source Code
;; Defined in /usr/src/emacs/lisp/mpc.el.gz
(defun mpc-secs-to-time (secs)
"Convert SECS from a string, integer or float value to a time string."
;; We could use `format-seconds', but it doesn't seem worth the trouble
;; because we'd still need to check (>= secs (* 60 100)) since the special
;; %z only allows us to drop the large units for small values but
;; not to drop the small units for large values.
(if (stringp secs) (setq secs (string-to-number secs)))
;; Ensure secs is an integer. The Time tag has been deprecated by MPD
;; and its replacement (the duration tag) includes fractional seconds.
(if (floatp secs) (setq secs (round secs)))
(if (>= secs (* 60 100)) ;More than 100 minutes.
(format "%dh%02d" ;"%d:%02d:%02d"
(/ secs 3600) (% (/ secs 60) 60)) ;; (% secs 60)
(format "%d:%02d" (/ secs 60) (% secs 60))))