Re: can I get support for 'current-time under slib
David Tillman wrote:
...
>
> (define unix-date
> (lambda (args)
> (let ((proc (run-process "/bin/date" args :output :pipe)))
> (read-line (process-output proc)))))
>
> Obviously, location of the date command may be different on your system.
>
> This gets you:
>
> STk> (unix-date "+%s")
> "990021904"
> STk> (unix-date "+%H:%M:%S")
> "09:05:07"
> STk> (unix-date "+%A, %B %d, %Y")
> "Wednesday, May 16, 2001"
Thanks VERY much David.
I'd discovered exec, but I compared that to your "roll-your-own"
solution
STk> (time (exec "date +%s"))
;; Time: 0.00ms
;; GC time: 0.00ms
;; Cells: 52
"990058790\n"
STk> (time (unix-date "+%s"))
;; Time: 0.00ms
;; GC time: 0.00ms
;; Cells: 14
"990058806"
So, your solution certainly seems more space efficient.
This will be fine for what I need...any more and I'll go hunting in the
FFI docs.
Thanks again
Chris
Received on Thu May 17 2001 - 02:30:57 CEST
This archive was generated by hypermail 2.3.0
: Mon Jul 21 2014 - 19:38:59 CEST