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.2 2003/08/13 18:53:42 kevin Exp $
12 ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
14 ;;;; *************************************************************************
16 (in-package #:uffi-tests)
18 (uffi:def-foreign-type time-t :unsigned-long)
31 (uffi:def-function ("time" c-time)
35 (uffi:def-function ("gmtime" c-gmtime)
39 (uffi:def-type time-t :unsigned-long)
40 (uffi:def-type tm-pointer (* tm))
43 (uffi:with-foreign-object (time 'time-t)
44 (setf (uffi:deref-pointer time :unsigned-long) 7381)
45 (uffi:deref-pointer time :unsigned-long))
49 (uffi:with-foreign-object (time 'time-t)
50 (setf (uffi:deref-pointer time :unsigned-long) 7381)
51 (let ((tm-ptr (the tm-pointer (c-gmtime time))))
52 (values (1+ (uffi:get-slot-value tm-ptr 'tm 'mon))
53 (uffi:get-slot-value tm-ptr 'tm 'mday)
54 (+ 1900 (uffi:get-slot-value tm-ptr 'tm 'year))
55 (uffi:get-slot-value tm-ptr 'tm 'hour)
56 (uffi:get-slot-value tm-ptr 'tm 'min)
57 (uffi:get-slot-value tm-ptr 'tm 'sec)