CLでSRFI-19 — #:g1

Posted 2012-03-27 05:45:00 GMT

CLでSRFI、今回は、SRFI-19の「Time Data Types and Procedures」です。
日時関係のライブラリです。今回触ってみるまで知りませんでしたが、結構便利に使えるように思いました。

動作

(time-utc->time-monotonic (make-time 'time-utc 704228000 1332823993))
;=>  #<TIME-MONOTONIC 1332824027.704228000>

(time-type (time-utc->time-monotonic (make-time 'time-utc 704228000 1332823993)))

(time-utc->time-monotonic (make-time 'time-utc 704228000 1332823993)) ;=> #<TIME-MONOTONIC 1332824027.704228000> (time-difference (current-time) (current-time)) ;=> #<TIME-DURATION 0.000030000> (let (t1 t2) (setq t1 (current-time)) (sleep 1/3) (setq t2 (current-time)) (time-difference t2 t1)) ;=> #<TIME-DURATION 3.334500000> (current-date) ;=> #<DATE 2012/03/27 14:20:48.6136890000 (32400)> (date->string (current-date)) ;=> "Tue Mar 27 14:23:11+0900 2012" (string->date "Tue Mar 27 14:23:11+0900 2012" "~a ~b ~d ~H:~M:~S~z ~Y")

(string->date "Tue Mar 27 14:23:11+0900 2012" "~a ~b ~d ~H:~M:~S~z ~Y") ;=> #<DATE 2012/03/27 14:23:11.000000000 (32400)>

移植について

gaucheを参考にprint-opjectを設定してみました。 ■

comments powered by Disqus