From cc739f67940b866f1a3b963cd1f35d1c0c81dd0c Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Sat, 23 Aug 2003 12:36:59 +0000 Subject: [PATCH] r5546: *** empty log message *** --- debian/changelog | 6 ++++++ tests/time.lisp | 31 +++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index d12c1b9..53dd391 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cl-uffi (1.3.3-1) unstable; urgency=low + + * Add gettimeofday to tests + + -- Kevin M. Rosenberg Sat, 23 Aug 2003 06:36:28 -0600 + cl-uffi (1.3.2-1) unstable; urgency=low * Patch from Edi Weitz diff --git a/tests/time.lisp b/tests/time.lisp index 2402b42..410d14c 100644 --- a/tests/time.lisp +++ b/tests/time.lisp @@ -7,7 +7,7 @@ ;;;; Author: Kevin M. Rosenberg ;;;; Date Started: Feb 2002 ;;;; -;;;; $Id: time.lisp,v 1.2 2003/08/13 18:53:42 kevin Exp $ +;;;; $Id: time.lisp,v 1.3 2003/08/23 12:36:59 kevin Exp $ ;;;; ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -59,7 +59,34 @@ 1 1 1970 2 3 1) - +(uffi:def-struct timeval + (secs :long) + (usecs :long)) +(uffi:def-struct timezone + (minutes-west :int) + (dsttime :int)) +(uffi:def-function ("gettimeofday" c-gettimeofday) + ((tv (* timeval)) + (tz (* timezone))) + :returning :int) + +(defun get-utime () + (uffi:with-foreign-object (tv 'timeval) + (let ((res (c-gettimeofday tv (uffi:make-null-pointer 'timezone)))) + (values + (+ (* 1000000 (uffi:get-slot-value tv 'timeval 'secs)) + (uffi:get-slot-value tv 'timeval 'usecs)) + res)))) +(deftest timeofday.1 + (multiple-value-bind (t1 res1) (get-utime) + (multiple-value-bind (t2 res2) (get-utime) + (and (or (= t2 t1) (> t2 t1)) + (> t1 1000000000) + (> t2 1000000000) + (zerop res1) + (zerop res2)))) + t) + -- 2.34.1