r9236: fix library loading, function name
[uffi.git] / tests / time.lisp
index 410d14c8174e8006f4290eff0d27834e11a642b3..aeedba089c3f813bcf1f194fe435c29dd2832e4f 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Author:        Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: time.lisp,v 1.3 2003/08/23 12:36:59 kevin Exp $
+;;;; $Id$
 ;;;;
 ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
             (zerop res2))))
   t)
             
+(defun posix-time-to-localtime-string (secs)
+  "Converts number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC)"
+  (string-right-trim
+   '(#\newline #\return)
+   (uffi:convert-from-cstring
+    (uffi:with-foreign-object (time 'time-t)
+                             (setf (uffi:deref-pointer time :unsigned-long)
+                                   secs)
+                             (c-time time)))))
+