mirror of
https://github.com/penpot/penpot.git
synced 2025-05-11 02:26:36 +02:00
✨ Enable edn writter for duration type.
This commit is contained in:
parent
9373296fd4
commit
e2d4d121d8
3 changed files with 21 additions and 4 deletions
|
@ -1,2 +1,3 @@
|
||||||
{uxbox/instant uxbox.util.time/from-string
|
{uxbox/instant uxbox.util.time/from-string
|
||||||
uxbox/cron uxbox.util.time/cron}
|
uxbox/cron uxbox.util.time/cron
|
||||||
|
uxbox/duration uxbox.util.time/parse-duration}
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
;;
|
;;
|
||||||
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
|
;; This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||||
|
;; defined by the Mozilla Public License, v. 2.0.
|
||||||
|
;;
|
||||||
|
;; Copyright (c) 2016-2020 Andrey Antukh <niwi@niwi.nz>
|
||||||
|
|
||||||
(ns uxbox.util.time
|
(ns uxbox.util.time
|
||||||
(:require
|
(:require
|
||||||
|
@ -54,9 +57,21 @@
|
||||||
:else
|
:else
|
||||||
(obj->duration ms-or-obj)))
|
(obj->duration ms-or-obj)))
|
||||||
|
|
||||||
|
(defn parse-duration
|
||||||
|
[s]
|
||||||
|
(assert (string? s))
|
||||||
|
(Duration/parse s))
|
||||||
|
|
||||||
(extend-protocol clojure.core/Inst
|
(extend-protocol clojure.core/Inst
|
||||||
java.time.Duration
|
java.time.Duration
|
||||||
(inst-ms* [v] (.toMillis ^java.time.Duration v)))
|
(inst-ms* [v] (.toMillis ^Duration v)))
|
||||||
|
|
||||||
|
(defmethod print-method Duration
|
||||||
|
[mv ^java.io.Writer writer]
|
||||||
|
(.write writer (str "#uxbox/duration \"" (.toString ^Duration mv) "\"")))
|
||||||
|
|
||||||
|
(defmethod print-dup Duration [o w]
|
||||||
|
(print-method o w))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Cron Expression
|
;; Cron Expression
|
||||||
|
@ -206,7 +221,7 @@
|
||||||
|
|
||||||
(defmethod print-method Instant
|
(defmethod print-method Instant
|
||||||
[mv ^java.io.Writer writer]
|
[mv ^java.io.Writer writer]
|
||||||
(.write writer (str "#instant \"" (.toString ^Instant mv) "\"")))
|
(.write writer (str "#uxbox/instant \"" (.toString ^Instant mv) "\"")))
|
||||||
|
|
||||||
(defmethod print-dup Instant [o w]
|
(defmethod print-dup Instant [o w]
|
||||||
(print-method o w))
|
(print-method o w))
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
[promesa.exec :as px]
|
[promesa.exec :as px]
|
||||||
[uxbox.migrations]
|
[uxbox.migrations]
|
||||||
[uxbox.util.storage :as st]
|
[uxbox.util.storage :as st]
|
||||||
|
[uxbox.util.time :as tm]
|
||||||
[mount.core :as mount]))
|
[mount.core :as mount]))
|
||||||
|
|
||||||
;; --- Benchmarking Tools
|
;; --- Benchmarking Tools
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue