r8495: add example function
authorKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 7 Jan 2004 13:29:24 +0000 (13:29 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 7 Jan 2004 13:29:24 +0000 (13:29 +0000)
tests/time.lisp

index 279dee0ff495f4ca27e19c38a76e8662ced9f899..8e2c6efcef4dbee009492f88f960b2c9d62e2e6d 100644 (file)
             (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-ctime time)))))
+