X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql%2Ftime.lisp;h=38ad86f12f577676c2e959649a971205a0e86f0a;hb=refs%2Fheads%2F6.8.0;hp=a7674a89277594218dc6c15b8f02b22701a253ea;hpb=67a4ab3576b630b8d34a6476ec8c1e9dfa913800;p=clsql.git diff --git a/sql/time.lisp b/sql/time.lisp index a7674a8..38ad86f 100644 --- a/sql/time.lisp +++ b/sql/time.lisp @@ -146,7 +146,7 @@ (declare (ignore _sec _min _hour _day _month _year _day-of-week)) (when dst? (incf tz -1)) - (values (- (* tz 60 60)) tz)))) + (values (* tz 60 60) tz)))) (defun time-to-utc (in) "Ensures that if we have a time thats not in UTC, treat it as a localtime, @@ -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))