Skip to content

Instantly share code, notes, and snippets.

@codecoll
Created April 8, 2020 07:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecoll/66b40f524111f0dff75921784a4b2095 to your computer and use it in GitHub Desktop.
Save codecoll/66b40f524111f0dff75921784a4b2095 to your computer and use it in GitHub Desktop.
Conversion of seconds to hours minutes seconds string in elisp
(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