Commit 390b8ea9 authored by James Prewett's avatar James Prewett
Browse files

began replacement of cybertigger-time with cl-date-time-parser

parent 2e34df9f
......@@ -11,8 +11,6 @@ CL-PPCRE:
http://www.weitz.de/files/cl-ppcre.tar.gz
CL-INTERPOL:
http://www.weitz.de/files/cl-interpol.tar.gz
time.lisp:
http://cybertiggyr.com/gene/pdl/time.lisp
CLUnit:
(packaged with LoGS)
---------------------------------------------------------------------
......
......@@ -8,7 +8,7 @@
;;;;
;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;o;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;;; GNU General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
......@@ -16,48 +16,11 @@
;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
(in-package :language)
(use-package :cybertiggyr-time)
(defun recognize-hhmmss (str tokens)
"Recognize HHMMSS separated by ':'s. All characters in the string
must be digits or :s, & the string must be of length 8."
(declare (type string str) (ignore tokens))
(and (eql (length str) 8)
(string-equal ":" (subseq str 2 3))
(string-equal ":" (subseq str 5 6))
(every #'digit-char-p (subseq str 0 2))
(every #'digit-char-p (subseq str 3 5))
(every #'digit-char-p (subseq str 6 8))
(cybertiggyr-time::make-broken-time
:ss (parse-integer str :start 6 :end 8)
:mm (parse-integer str :start 3 :end 5)
:hh (parse-integer str :start 0 :end 2)
:dd (funcall *default-day*)
:mo (funcall *default-month*)
:yr (funcall *default-year*)
:zone nil)))
(ql:quickload :cl-date-time-parser)
(use-package :cl-date-time-parser)
(defun recognize-hhmmss-tomorrow (str tokens)
"Recognize HHMMSS separated by ':'s. All characters in the string
must be digits or :s, & the string must be of length 17."
(declare (type string str) (ignore tokens))
(and (eql (length str) 17)
(string-equal "tomorrow" (subseq str 9 17))
(string-equal ":" (subseq str 2 3))
(string-equal ":" (subseq str 5 6))
(every #'digit-char-p (subseq str 0 2))
(every #'digit-char-p (subseq str 3 5))
(every #'digit-char-p (subseq str 6 8))
(let ((tomorrow-date (+ 1 (funcall *default-day*))))
(cybertiggyr-time::make-broken-time
:ss (parse-integer str :start 6 :end 8)
:mm (parse-integer str :start 3 :end 5)
:hh (parse-integer str :start 0 :end 2)
:dd (if (< tomorrow-date 31)
tomorrow-date
1)
:mo (if (> 31 (+ 1 (funcall *default-day*)))
(funcall *default-month*)
(+ 1 (funcall *default-month*)))
:yr (funcall *default-year*)
:zone nil))))
(error "nope")
)
......@@ -20,9 +20,8 @@
;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
(defpackage :org.prewett.LoGS.language
(:use #:cl #:cybertiggyr-time #:logs)
(:use #:cl #:logs #:cl-date-time-parser)
; (:import-from #:logs #:rule #:ruleset #:message #:exec #:context)
(:import-from #:cybertiggyr-time #:make-broken-time)
(:nicknames #:language)
(:export timeout))
......
......@@ -474,11 +474,13 @@ on the required behaviour for SLOT."))
(defmethod resolve-time ((seconds string))
(calculate-timeout
(cybertiggyr-time:parse-time
(cl-date-time-parser:parse-date-time
seconds
(list
#'recognize-hhmmss
#'recognize-hhmmss-tomorrow))
;;
;; (list
;; #'recognize-hhmmss
;; #'recognize-hhmmss-tomorrow)
)
:AT T))
(defmethod resolve-time ((seconds number))
......
......@@ -22,5 +22,5 @@ LOGS_CORE="LoGS-sbcl.core"
LOGS_EXE="logs-replay"
# CYBERTIGGYR_TIME="time.lisp"
sbcl --eval '(require :asdf)' --eval "(progn (push #p\"../../\" asdf:*central-registry*) (require 'cybertiggyr-time) (require 'logs) (in-package :org.prewett.LoGS) (SAVE-LISP-AND-DIE \"$LOGS_CORE\"))"
sbcl --eval '(require :asdf)' --eval "(progn (push #p\"../../\" asdf:*central-registry*) (require 'logs) (in-package :org.prewett.LoGS) (SAVE-LISP-AND-DIE \"$LOGS_CORE\"))"
sbcl --core $LOGS_CORE --load "logs-replay.lisp" --eval "(SB-EXT:SAVE-LISP-AND-DIE \"$LOGS_EXE\" :executable t :toplevel #'main)"
......@@ -22,7 +22,7 @@
:author "James E. Prewett <Jim@Prewett.org>"
:licence "GPL"
:serial t
:depends-on (:cl-ppcre :cl-cli :cybertiggyr-time)
:depends-on (:cl-ppcre :cl-cli :cl-date-time-parser)
:components ((:file "package")
(:file "LoGS")
(:module "data_structures"
......
......@@ -132,13 +132,11 @@
do
;; what to do if the time doesn't parse?
;; for now, just keep the last timestamp and move on
(aif (cybertiggyr-time:parse-time
(aif (cl-date-time-parser:parse-date-time
(subseq
(message *message*)
*timestamp-start*
*timestamp-end*)
(list (cybertiggyr-time::make-fmt-recognizer
*timestamp-format*)))
*timestamp-end*))
(setq *now* it))
end
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment