projects
/
uffi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r1923: *** empty log message ***
[uffi.git]
/
tests
/
gettime.cl
diff --git
a/tests/gettime.cl
b/tests/gettime.cl
index 12012565ffc9f5d827ad09da169021d934c9edbe..c562fade74e514648dace5c253ed1d531a32c08c 100644
(file)
--- a/
tests/gettime.cl
+++ b/
tests/gettime.cl
@@
-7,7
+7,7
@@
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Feb 2002
;;;;
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Feb 2002
;;;;
-;;;; $Id: gettime.cl,v 1.
6 2002/03/14 21:03:12
kevin Exp $
+;;;; $Id: gettime.cl,v 1.
9 2002/04/02 23:27:05
kevin Exp $
;;;;
;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
;;;;
;;;;
;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
;;;;
@@
-44,8
+44,8
@@
(defun gettime ()
"Returns the local time"
(defun gettime ()
"Returns the local time"
- (
let* ((time (uffi:allocate-foreign-object time-t))
)
- (declare (type time-t time))
+ (
uffi:with-foreign-object (time 'time-t
)
+
;;
(declare (type time-t time))
(c-time time)
(let ((tm-ptr (the tm-pointer (c-localtime time))))
(declare (type tm-pointer tm-ptr))
(c-time time)
(let ((tm-ptr (the tm-pointer (c-localtime time))))
(declare (type tm-pointer tm-ptr))
@@
-57,14
+57,20
@@
(uffi:get-slot-value tm-ptr 'tm 'min)
(uffi:get-slot-value tm-ptr 'tm 'sec)
)))
(uffi:get-slot-value tm-ptr 'tm 'min)
(uffi:get-slot-value tm-ptr 'tm 'sec)
)))
- (uffi:free-foreign-object time)
- time-string))
- ))
+ time-string))))
-#+
test
-uffi
+#+
examples
-uffi
(format t "~&~A" (gettime))
(format t "~&~A" (gettime))
+#+test-uffi
+(progn
+ (let ((time (gettime)))
+ (util.test:test (stringp time) t :fail-info "Time is not a string")
+ (util.test:test (plusp (parse-integer time :junk-allowed t))
+ t
+ :fail-info "time string does not start with a number")))
+