feat(klatre): add dottime-format function

Add a function to klatre format a timestamp using dottime

Change-Id: I24d8d91f49f352b606f44834f7229ab55b55afa0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1344
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: kanepyork <rikingcoding@gmail.com>
This commit is contained in:
Griffin Smith 2020-07-21 22:07:26 -04:00 committed by glittershark
parent d60c639162
commit f591c32dfb
3 changed files with 28 additions and 1 deletions

View file

@ -68,3 +68,23 @@ separated by SEP."
(vector-push-extend (char sep (the fixnum k)) vs))))
lst)
vs))
;;;
;;; String handling
;;;
(defconstant +dottime-format+
'((:year 4) #\- (:month 2) #\- (:day 2)
#\T
(:hour 2) #\· (:min 2) "+00") ; TODO(grfn): Allow passing offset
"`:LOCAL-TIME' format specifier for dottime")
(defun format-dottime (timestamp)
"Return TIMESTAMP formatted as dottime, using a +00 offset"
(check-type timestamp local-time:timestamp)
(local-time:format-timestring nil timestamp
:format +dottime-format+
:timezone local-time:+utc-zone+))
(comment
(format-dottime (local-time:now)))