-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclsql-local-time.lisp
More file actions
24 lines (20 loc) · 1012 Bytes
/
clsql-local-time.lisp
File metadata and controls
24 lines (20 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
;;;; clsql-local-time.lisp
(in-package #:clsql-local-time)
(defmethod clsql-sys:read-sql-value (val (type (eql 'local-time:timestamp)) database db-type)
(let ((wall-time (clsql-sys:parse-timestring val)))
(multiple-value-bind (usec sec min hour day month year dow)
(clsql-sys:decode-time wall-time)
(let ((ret (local-time:encode-timestamp (* usec 1000) sec min hour day month year :timezone local-time:+utc-zone+)))
ret))))
(defmethod clsql-sys::database-output-sql ((time local-time:timestamp) database)
(clsql-sys::database-output-sql
(local-time:format-timestring
nil time :format
'((:year 4) "-"
(:month 2) "-"
(:day 2) " "
(:hour 2) ":"
(:min 2) ":"
(:sec 2) " " :timezone ) :timezone local-time:+utc-zone+) database))
(defmethod clsql-sys:database-get-type-specifier ((type (eql 'local-time:timestamp)) args database db-type)
(clsql-sys:database-get-type-specifier 'clsql:wall-time args database db-type))