use local-time for timestamp conversions; + revert: timestamptz in db
This commit is contained in:
parent
bee8d6d75e
commit
3f3da9b69b
3 changed files with 6 additions and 3 deletions
|
@ -6,7 +6,7 @@
|
||||||
:version "0.0.1"
|
:version "0.0.1"
|
||||||
:homepage "https://www.cyberconcepts.org"
|
:homepage "https://www.cyberconcepts.org"
|
||||||
:description ""
|
:description ""
|
||||||
:depends-on (:dbi :str :sxql)
|
:depends-on (:dbi :local-time :str :sxql)
|
||||||
:components ((:file "forge/forge")
|
:components ((:file "forge/forge")
|
||||||
(:file "storage/storage")
|
(:file "storage/storage")
|
||||||
(:file "storage/tracking" :depends-on ("storage/storage"))
|
(:file "storage/tracking" :depends-on ("storage/storage"))
|
||||||
|
|
|
@ -42,7 +42,8 @@
|
||||||
(let ((vl (head-proplist track)))
|
(let ((vl (head-proplist track)))
|
||||||
(with-slots ((trid trackid) (ts time-stamp) data) track
|
(with-slots ((trid trackid) (ts time-stamp) data) track
|
||||||
(if trid (setf (getf vl :trackid) trid))
|
(if trid (setf (getf vl :trackid) trid))
|
||||||
(if ts (setf (getf vl :timestamp) ts))
|
(if ts (setf (getf vl :timestamp)
|
||||||
|
(format nil "~a" (local-time:universal-to-timestamp ts))))
|
||||||
(if data (setf (getf vl :data) data)))
|
(if data (setf (getf vl :data) data)))
|
||||||
vl))
|
vl))
|
||||||
|
|
||||||
|
@ -75,7 +76,7 @@
|
||||||
(nconc
|
(nconc
|
||||||
`((trackid :type ,id-type :primary-key t :not-null t))
|
`((trackid :type ,id-type :primary-key t :not-null t))
|
||||||
hf-def
|
hf-def
|
||||||
`((timestamp :type timestamp :not-null t :default current_timestamp)
|
`((timestamp :type timestamptz :not-null t :default current_timestamp)
|
||||||
(data :type ,json-type :not-null t :default |'{}'|)))))
|
(data :type ,json-type :not-null t :default |'{}'|)))))
|
||||||
(create-indexes st table tn (indexes cont))))
|
(create-indexes st table tn (indexes cont))))
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,11 @@
|
||||||
(storage:drop-table st :testing.tracks)
|
(storage:drop-table st :testing.tracks)
|
||||||
(tracking:create-table cont)
|
(tracking:create-table cont)
|
||||||
(setf tr (tracking:make-item cont "t01" "john"))
|
(setf tr (tracking:make-item cont "t01" "john"))
|
||||||
|
(setf (tracking:time-stamp tr) (get-universal-time))
|
||||||
(== (tracking:head tr) '("t01" "john"))
|
(== (tracking:head tr) '("t01" "john"))
|
||||||
(== (tracking:head-proplist tr) '(:username "john" :taskid "t01"))
|
(== (tracking:head-proplist tr) '(:username "john" :taskid "t01"))
|
||||||
(== (tracking:data tr) nil)
|
(== (tracking:data tr) nil)
|
||||||
(tracking:insert tr)
|
(tracking:insert tr)
|
||||||
(== (tracking:trackid tr) 1)
|
(== (tracking:trackid tr) 1)
|
||||||
|
(print (local-time:universal-to-timestamp (tracking:time-stamp tr)))
|
||||||
))
|
))
|
||||||
|
|
Loading…
Add table
Reference in a new issue