mirror of
https://github.com/penpot/penpot.git
synced 2026-02-13 07:02:58 +00:00
✨ Enable edn writter for duration type.
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
{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
|
||||
;; 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
|
||||
(:require
|
||||
@@ -54,9 +57,21 @@
|
||||
:else
|
||||
(obj->duration ms-or-obj)))
|
||||
|
||||
(defn parse-duration
|
||||
[s]
|
||||
(assert (string? s))
|
||||
(Duration/parse s))
|
||||
|
||||
(extend-protocol clojure.core/Inst
|
||||
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
|
||||
@@ -206,7 +221,7 @@
|
||||
|
||||
(defmethod print-method Instant
|
||||
[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]
|
||||
(print-method o w))
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
[promesa.exec :as px]
|
||||
[uxbox.migrations]
|
||||
[uxbox.util.storage :as st]
|
||||
[uxbox.util.time :as tm]
|
||||
[mount.core :as mount]))
|
||||
|
||||
;; --- Benchmarking Tools
|
||||
|
||||
Reference in New Issue
Block a user