1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
6 ;;;; Purpose: UFFI test file, time, use C structures
7 ;;;; Author: Kevin M. Rosenberg
8 ;;;; Date Started: Feb 2002
10 ;;;; $Id: time.lisp,v 1.1 2003/04/30 14:06:14 kevin Exp $
12 ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
14 ;;;; UFFI users are granted the rights to distribute and use this software
15 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
16 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
17 ;;;; *************************************************************************
19 (in-package :uffi-tests)
21 (uffi:def-foreign-type time-t :unsigned-long)
34 (uffi:def-function ("time" c-time)
38 (uffi:def-function ("gmtime" c-gmtime)
42 (uffi:def-type time-t :unsigned-long)
43 (uffi:def-type tm-pointer (* tm))
46 (uffi:with-foreign-object (time 'time-t)
47 (setf (uffi:deref-pointer time :unsigned-long) 7381)
48 (uffi:deref-pointer time :unsigned-long))
52 (uffi:with-foreign-object (time 'time-t)
53 (setf (uffi:deref-pointer time :unsigned-long) 7381)
54 (let ((tm-ptr (the tm-pointer (c-gmtime time))))
55 (values (1+ (uffi:get-slot-value tm-ptr 'tm 'mon))
56 (uffi:get-slot-value tm-ptr 'tm 'mday)
57 (+ 1900 (uffi:get-slot-value tm-ptr 'tm 'year))
58 (uffi:get-slot-value tm-ptr 'tm 'hour)
59 (uffi:get-slot-value tm-ptr 'tm 'min)
60 (uffi:get-slot-value tm-ptr 'tm 'sec)