summaryrefslogtreecommitdiff
path: root/utilities.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'utilities.lisp')
-rw-r--r--utilities.lisp12
1 files changed, 12 insertions, 0 deletions
diff --git a/utilities.lisp b/utilities.lisp
index abe10b7..96f391c 100644
--- a/utilities.lisp
+++ b/utilities.lisp
@@ -96,3 +96,15 @@
(defun read-from-file (path)
(read-from-string
(alexandria:read-file-into-string path)))
+
+
+(defun secs-to-hms (secs)
+ (let ((hours (floor (/ secs (* 60 60))))
+ (mins (floor (/ (mod secs (* 60 60))
+ 60)))
+ (secs (mod secs 60)))
+ (if (plusp hours)
+ (format nil "~a:~2,'0d:~2,'0d"
+ hours mins secs)
+ (format nil "~a:~2,'0d"
+ mins secs))))