 ;;; seconds-to-human-time.el --- Convert seconds to human time -*- lexical-binding: t -*-
-;; Time-stamp: <2018-02-16 15:30:04 kmodi>
+;; Time-stamp: <2018-02-20 14:10:01 kmodi>
 ;; https://scripter.co/convert-seconds-to-human-time/
 
 (defun seconds-to-human-time (&optional seconds)

when this function is called recursively.

When called interactively, if a region is selected SECONDS is
extracted from that, else the user is prompted to enter those."
  (interactive)
  (let ((inter (called-interactively-p 'interactive)))
    (when inter

      ;; recursive call.  Return the time as a string only then.  For
      ;; re-entrant executions, return the `time' list instead.
      (if (numberp seconds)
          (let ((ret-val (funcall gen-time-string time inter))
                (arg current-prefix-arg))
            (cond
             ((equal arg '(4))
              (kill-new ret-val))
             ((and (use-region-p)
                   (equal arg '(16)))
              (delete-active-region)
              (insert ret-val))))
        time))))

;; Tests
