X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=sql%2Ftime.lisp;h=39d9e4dc3483a70272ee06d2bdef50185556e2ea;hp=a7674a89277594218dc6c15b8f02b22701a253ea;hb=868477640206e55887d5c017d1e47a58ef64dc47;hpb=67a4ab3576b630b8d34a6476ec8c1e9dfa913800 diff --git a/sql/time.lisp b/sql/time.lisp index a7674a8..39d9e4d 100644 --- a/sql/time.lisp +++ b/sql/time.lisp @@ -158,6 +158,16 @@ (setf (time-is-utc? newt) T) newt))) +(defun time-to-localtime (in) + "Ensures that if we have a time thats not in UTC, treat it as a localtime, + and convert to UTC" + (if (not (time-is-utc? in)) + in + (let ((newt + (time+ in (make-duration :second (- (%universal-ts-offset in)))))) + (setf (time-is-utc? newt) nil) + newt))) + (defun make-time (&key (year 0) (month 1) (day 1) (hour 0) (minute 0) (second 0) (usec 0) (offset nil)) (let* ((mjd (gregorian-to-mjd month day year))