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

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

parent 2e34df9f
LoGS LoGS
*.core *.core
*.fasl
...@@ -11,8 +11,6 @@ CL-PPCRE: ...@@ -11,8 +11,6 @@ CL-PPCRE:
http://www.weitz.de/files/cl-ppcre.tar.gz http://www.weitz.de/files/cl-ppcre.tar.gz
CL-INTERPOL: CL-INTERPOL:
http://www.weitz.de/files/cl-interpol.tar.gz http://www.weitz.de/files/cl-interpol.tar.gz
time.lisp:
http://cybertiggyr.com/gene/pdl/time.lisp
CLUnit: CLUnit:
(packaged with LoGS) (packaged with LoGS)
--------------------------------------------------------------------- ---------------------------------------------------------------------
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
;;;; ;;;;
;;;; This program is distributed in the hope that it will be useful, ;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; 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. ;;;; GNU General Public License for more details.
;;;; ;;;;
;;;; You should have received a copy of the GNU General Public License ;;;; You should have received a copy of the GNU General Public License
...@@ -16,48 +16,11 @@ ...@@ -16,48 +16,11 @@
;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
(in-package :language) (in-package :language)
(use-package :cybertiggyr-time) (ql:quickload :cl-date-time-parser)
(use-package :cl-date-time-parser)
(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)))
(defun recognize-hhmmss-tomorrow (str tokens) (defun recognize-hhmmss-tomorrow (str tokens)
"Recognize HHMMSS separated by ':'s. All characters in the string "Recognize HHMMSS separated by ':'s. All characters in the string
must be digits or :s, & the string must be of length 17." must be digits or :s, & the string must be of length 17."
(declare (type string str) (ignore tokens)) (error "nope")
(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))))
...@@ -20,9 +20,8 @@ ...@@ -20,9 +20,8 @@
;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
(defpackage :org.prewett.LoGS.language (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 #:logs #:rule #:ruleset #:message #:exec #:context)
(:import-from #:cybertiggyr-time #:make-broken-time)
(:nicknames #:language) (:nicknames #:language)
(:export timeout)) (:export timeout))
......
...@@ -474,11 +474,13 @@ on the required behaviour for SLOT.")) ...@@ -474,11 +474,13 @@ on the required behaviour for SLOT."))
(defmethod resolve-time ((seconds string)) (defmethod resolve-time ((seconds string))
(calculate-timeout (calculate-timeout
(cybertiggyr-time:parse-time (cl-date-time-parser:parse-date-time
seconds seconds
(list ;;
#'recognize-hhmmss ;; (list
#'recognize-hhmmss-tomorrow)) ;; #'recognize-hhmmss
;; #'recognize-hhmmss-tomorrow)
)
:AT T)) :AT T))
(defmethod resolve-time ((seconds number)) (defmethod resolve-time ((seconds number))
......
...@@ -22,5 +22,5 @@ LOGS_CORE="LoGS-sbcl.core" ...@@ -22,5 +22,5 @@ LOGS_CORE="LoGS-sbcl.core"
LOGS_EXE="logs-replay" LOGS_EXE="logs-replay"
# CYBERTIGGYR_TIME="time.lisp" # 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)" 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 @@ ...@@ -22,7 +22,7 @@
:author "James E. Prewett <Jim@Prewett.org>" :author "James E. Prewett <Jim@Prewett.org>"
:licence "GPL" :licence "GPL"
:serial t :serial t
:depends-on (:cl-ppcre :cl-cli :cybertiggyr-time) :depends-on (:cl-ppcre :cl-cli :cl-date-time-parser)
:components ((:file "package") :components ((:file "package")
(:file "LoGS") (:file "LoGS")
(:module "data_structures" (:module "data_structures"
......
...@@ -132,13 +132,11 @@ ...@@ -132,13 +132,11 @@
do do
;; what to do if the time doesn't parse? ;; what to do if the time doesn't parse?
;; for now, just keep the last timestamp and move on ;; for now, just keep the last timestamp and move on
(aif (cybertiggyr-time:parse-time (aif (cl-date-time-parser:parse-date-time
(subseq (subseq
(message *message*) (message *message*)
*timestamp-start* *timestamp-start*
*timestamp-end*) *timestamp-end*))
(list (cybertiggyr-time::make-fmt-recognizer
*timestamp-format*)))
(setq *now* it)) (setq *now* it))
end end
end end
......
Supports Markdown
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