[cffi-devel] Unexpected return
Martin Simmons
martin at lispworks.com
Wed Feb 22 22:29:27 UTC 2006
>>>>> On Thu, 23 Feb 2006 00:07:43 +0530, "N. Raghavendra" <raghu at mri.ernet.in> said:
>
> I hope this is not OT. I am trying to learn to use CFFI. Following
> the CFFI manual, I wrote the following functions, which call some
> basic C time functions. According to gmtime(3), the function `gmtoff'
> below should always return 0. However, I consistently get
>
> TIMEZONE-FFI> (gmtoff)
> 672421260
>
> I would appreciate any hints as to where I am erring. In case it is
> relevant, the environment is CMUCL 19c on FreeBSD 6.0-STABLE.
>
> TIA,
> Raghavendra.
>
> --- code follows ---
>
> (defpackage #:timezone-ffi
> (:use #:common-lisp
> #:cffi))
>
> (in-package #:timezone-ffi)
>
> (defcstruct tm
> (sec :int)
> (min :int)
> (hour :int)
> (mday :int)
> (mon :int)
> (year :int)
> (wday :int)
> (yday :int)
> (isdst :boolean)
> (zone :string)
> (gmtoff :long))
I think you have zone and gmtoff in the wrong order (the man pages don't
specify the order, so check the header files).
__Martin
More information about the cffi-devel
mailing list