Created
April 8, 2020 07:44
-
-
Save codecoll/66b40f524111f0dff75921784a4b2095 to your computer and use it in GitHub Desktop.
Conversion of seconds to hours minutes seconds string in elisp
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
(let* ((secs 100) | |
(hours (/ secs 3600)) | |
(minutes (/ (% secs 3600) 60)) | |
(seconds (% secs 60))) | |
(format "%s%s%s" | |
(if (> hours 0) | |
(format "%sh " hours) | |
"") | |
(if (> minutes 0) | |
(format "%sm " minutes) | |
"") | |
(if (> seconds 0) | |
(format "%ss" seconds) | |
""))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment