diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bgpstore.lisp | 12 | ||||
-rw-r--r-- | src/util.lisp | 10 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/bgpstore.lisp b/src/bgpstore.lisp index 2c3b8ed..ba448ee 100644 --- a/src/bgpstore.lisp +++ b/src/bgpstore.lisp @@ -4,12 +4,20 @@ (defun start-bgpstore (host port) (with-connection *db-spec* - (let ((reader (new-reader host port))) + (let ((reader (new-reader host port)) + (count 0)) (do ((e (next-xml-blurb reader "BGP_MESSAGE") (next-xml-blurb reader "BGP_MESSAGE"))) ((null e)) (dolist (obj (new-entries (xml-top-elem-from-octets e))) - (insert-dao obj))) + (insert-dao obj) + (incf count) + (if (mod count 100) (format t ".") + (if (mod count 1000) (format t "+") + (if (mod count 10000) + (format t "~%~A ~A " + (iso-date (get-universal-time) t) + count)))) (close-reader)))) (defun stop-bgpstore ()) diff --git a/src/util.lisp b/src/util.lisp index 32f7d73..87661a0 100644 --- a/src/util.lisp +++ b/src/util.lisp @@ -55,3 +55,13 @@ BUGS: (read-byte (usocket:socket-stream sock) nil))) (defun close-reader () (usocket:socket-close sock))) + +(defun iso-date (universal-time &optional (include-seconds nil)) + "Return a string denoting UNIVERSAL-TIME" + (multiple-value-bind (second minute hour day month year) + (decode-universal-time universal-time) + (if include-seconds + (format nil "~4,'0D-~2,'0D-~2,'0D ~2,'0D:~2,'0D:~2,'0D" + year month day hour minute second) + (format nil "~4,'0D-~2,'0D-~2,'0D ~2,'0D:~2,'0D" + year month day hour minute)))) |