Created
July 26, 2017 13:44
-
-
Save 10nin/5f69b85a6e65a6e54a10094d5b0d2a20 to your computer and use it in GitHub Desktop.
Convert Decimal minutes (DM) and SI minuts & second
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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