Skip to content

Instantly share code, notes, and snippets.

@10nin
Created July 26, 2017 13:44
Show Gist options
  • Save 10nin/5f69b85a6e65a6e54a10094d5b0d2a20 to your computer and use it in GitHub Desktop.
Save 10nin/5f69b85a6e65a6e54a10094d5b0d2a20 to your computer and use it in GitHub Desktop.
Convert Decimal minutes (DM) and SI minuts & second
;; Convert DM->second
(defun dm-to-sec (x)
(* (/ x 100.0) 60.0))
;; Convert DM->minutes
(defun dm-to-min (x)
(/ x 100.0))
;; Convert second->minutes
(defun sec-to-min (x)
(/ x 60.0))
;; second->minutes convert with m:s.# style format
(defun sec-to-min-formatted (x)
(let ((ms (multiple-value-list (truncate x 60.0))))
(format t "~a : ~a " (car ms) (cadr ms))))
;; DM->minutes convert with m:s.# style format
(defun dm-to-min-formatted (x)
(sec-to-min-formatted (dm-to-sec x)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment