summaryrefslogtreecommitdiff
path: root/utilities.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'utilities.lisp')
-rw-r--r--utilities.lisp21
1 files changed, 19 insertions, 2 deletions
diff --git a/utilities.lisp b/utilities.lisp
index d58eb47..c3f49c1 100644
--- a/utilities.lisp
+++ b/utilities.lisp
@@ -9,5 +9,22 @@
(defvar *epoch* (encode-universal-time 0 0 0 1 1 1970)
"Jan 1 1970 Unix Epoch time in CL universal time.")
-(defun epoch-time (time)
- (multiple-value-list (decode-universal-time (+ *epoch* time))))
+(defun format-time (time)
+ (multiple-value-bind (_ min hour day month year)
+ (decode-universal-time time)
+ (declare (ignore _))
+ (format nil "~2,'0d-~2,'0d-~a ~2,'0d:~2,'0d"
+ month day year hour min)))
+
+(defmacro with-page ((&key title) &body body)
+ "A helper macro for defining some standard page boilerplate."
+ (let ((title-var (gensym)))
+ `(let ((,title-var ,title))
+ (with-html-string
+ (:doctype)
+ (:html
+ (:head
+ (:script :src "http://localhost:8080/skewer")
+ (:title ,title-var))
+ (:body
+ ,@body))))))