
hi, please see the attached patch, also pasted at the end of the mail for convenience. i'm not sure about the way time-t is defined, maybe someone with more insight into cffi can approve it or declare it as a hack.. -- attila diff --git a/posix/basic-unix.lisp b/posix/basic-unix.lisp index fcc16e7..7c795d3 100644 --- a/posix/basic-unix.lisp +++ b/posix/basic-unix.lisp @@ -187,6 +187,9 @@ (defun time () (%time (null-pointer))) +(deftype time-t () + `(unsigned-byte ,(* (cffi:foreign-type-size 'time) 8))) + ;;;; sys/stat.h (define-c-struct-wrapper stat ()) diff --git a/posix/unix.lisp b/posix/unix.lisp index 2878286..d91dd90 100644 --- a/posix/unix.lisp +++ b/posix/unix.lisp @@ -331,6 +331,9 @@ (clockid clockid) (res :pointer)) + (declaim (ftype (function (fixnum) (values time-t (integer 0 999999999))) + clock-getres)) + (defun clock-getres (clock-id) (with-foreign-object (ts 'timespec) (with-foreign-slots ((sec nsec) ts timespec) @@ -341,8 +344,13 @@ (clockid clockid) (tp :pointer)) + (declaim (inline clock-gettime) + (ftype (function (fixnum) (values time-t (integer 0 999999999))) + clock-gettime)) + (defun clock-gettime (clock-id) "Returns the time of the clock CLOCKID." + (declare (optimize (speed 3) (safety 2))) (with-foreign-object (ts 'timespec) (with-foreign-slots ((sec nsec) ts timespec) (%clock-gettime clock-id ts)