~pepe/neil

438953e7d94affbac6468f9ba355af44e75e9c38 — Josef Pospíšil 3 months ago 6476e53
Use bearimy local time
2 files changed, 16 insertions(+), 12 deletions(-)

M neil/guides.janet
M neil/utils.janet
M neil/guides.janet => neil/guides.janet +10 -10
@@ 1,6 1,6 @@
# Code used for navigating and transforming
# the brush. Plus some utilities.
(use eleanor bearimy/utils marble manisha fzy)
(use eleanor bearimy bearimy/utils marble manisha fzy)

(import /neil/appraisers :prefix "" :export true)



@@ 71,15 71,15 @@

(defn stamp
  ```
  Constructs table with timestamp of `now`
  Constructs table with timestamp of `dt`
  under `:timestamp` key.
  ```
  [&opt now]
  (default now (os/time))
  [&opt dt]
  (default dt (now))
  (def t
    (case (type now)
      :number now
      (:epoch now)))
    (case (type dt)
      :number dt
      (:epoch dt)))
  {:timestamp t})

(defn populate


@@ 87,10 87,10 @@
  Populates `data` with basic info.
  ```
  [data]
  (def now (os/time))
  (def dt (now))
  (merge
    {:created now :state "active"}
    data (stamp now)))
    {:created dt :state "active"}
    data (stamp dt)))


(defn save

M neil/utils.janet => neil/utils.janet +6 -2
@@ 81,8 81,12 @@
(defmacro conn-fiber
  ```
  Convenience macro for constructing fiber, handling connection,
  which is also set as `dyn`
  which is also set as `dyn`. It also sets `:local-time` for bearimy
  to format strings in local time zone of the server.
  ```
  [handling]
  ~(fiber/new
     (fn [conn] (setdyn :conn conn) (,handling conn)) :tp))
     (fn [conn]
       (setdyn :conn conn)
       (setdyn :local-time true)
       (,handling conn)) :tp))