PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 3ms RepoModel.GetById 38ms app.codeStats 0ms

/src/util/misc.lisp

http://github.com/skypher/cl-oauth
Lisp | 25 lines | 18 code | 7 blank | 0 comment | 1 complexity | 8d94a6fffb2a4eabd40ae74f918142d0 MD5 | raw file
 1
 2(in-package :oauth)
 3
 4(defun alist->plist (alist)
 5  "Converts an alist to plist."
 6  (let ((keyword-package (find-package :keyword)))
 7    (loop for i in alist
 8       collect (if (symbolp (car i))
 9                   (intern (symbol-name (car i)) keyword-package)
10                   (intern (string-upcase (car i)) keyword-package))
11       collect (cdr i))))
12
13(defun splice-alist (alist)
14  (reduce #'nconc (mapcar (lambda (x)
15                            (list (car x) (cdr x)))
16                          alist)))
17
18(defun between (what lower upper)
19  (and (>= what lower) (<= what upper)))
20
21(defconstant +unix-to-universal-time+ 2208988800)
22
23(defun get-unix-time (&optional (ut (get-universal-time)))
24  (- ut +unix-to-universal-time+))
25