feat(klatre): expose utility to format dot time offset
Turns out this is an annoying thingy you sometimes to implement independently from formatting an entire timestamp, so we expose it for reuse. Change-Id: I11de2823eb03849ea78fc79e2f546e413882930f Reviewed-on: https://cl.tvl.fyi/c/depot/+/3163 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi> Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
parent
b36a75a223
commit
f60d174591
2 changed files with 7 additions and 1 deletions
|
@ -86,6 +86,12 @@ separated by SEP."
|
|||
(local-time:format-timestring nil timestamp
|
||||
:format dottime-format
|
||||
:timezone local-time:+utc-zone+)
|
||||
(format-dottime-offset offset)))
|
||||
|
||||
(defun format-dottime-offset (offset)
|
||||
"Render OFFSET in hours in the format specified by dottime."
|
||||
(check-type offset integer)
|
||||
(concatenate 'string
|
||||
; render sign manually since format prints it after padding
|
||||
(if (>= offset 0) "+" "-")
|
||||
(format nil "~2,'0D" (abs offset))))
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
;; String handling
|
||||
#:+dottime-format+ #:format-dottime
|
||||
#:try-parse-integer
|
||||
#:try-parse-integer #:format-dottime-offset
|
||||
|
||||
;; Function utilities
|
||||
#:partial))
|
||||
|
|
Loading…
Reference in a new issue