Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
27228844
Commit
27228844
authored
20 years ago
by
rtoy
Browse files
Options
Downloads
Patches
Plain Diff
Allow parse-time to parse times like "2004-12-23T09:48:30z".
parent
7f305329
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/parse-time.lisp
+18
-3
18 additions, 3 deletions
code/parse-time.lisp
with
18 additions
and
3 deletions
code/parse-time.lisp
+
18
−
3
View file @
27228844
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain.
;;; Carnegie Mellon University, and has been placed in the public domain.
;;;
;;;
(
ext:file-comment
(
ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/parse-time.lisp,v 1.1
1
200
3/08
/2
9
1
9:22:32 gerd
Exp $"
)
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/parse-time.lisp,v 1.1
2
200
4/12
/2
3
1
4:49:29 rtoy
Exp $"
)
;;;
;;;
;;; **********************************************************************
;;; **********************************************************************
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
(
defconstant
whitespace-chars
'
(
#\space
#\tab
#\newline
#\,
#\'
#\`
))
(
defconstant
whitespace-chars
'
(
#\space
#\tab
#\newline
#\,
#\'
#\`
))
(
defconstant
time-dividers
'
(
#\:
#\.
))
(
defconstant
time-dividers
'
(
#\:
#\.
))
(
defconstant
date-dividers
'
(
#\\
#\/
#\-
))
(
defconstant
date-dividers
'
(
#\\
#\/
#\-
))
(
defconstant
date-time-dividers
'
(
#\T
#\t
))
(
defvar
*error-on-mismatch*
nil
(
defvar
*error-on-mismatch*
nil
"If t, an error will be signalled if parse-time is unable
"If t, an error will be signalled if parse-time is unable
...
@@ -85,7 +86,8 @@
...
@@ -85,7 +86,8 @@
(
"edt"
.
4
)
(
"cst"
.
6
)
(
"edt"
.
4
)
(
"cst"
.
6
)
(
"cdt"
.
5
)
(
"mst"
.
7
)
(
"cdt"
.
5
)
(
"mst"
.
7
)
(
"mdt"
.
6
)
(
"pst"
.
8
)
(
"mdt"
.
6
)
(
"pst"
.
8
)
(
"pdt"
.
7
)
(
"utc"
.
0
))
(
"pdt"
.
7
)
(
"utc"
.
0
)
(
"z"
.
0
))
*zone-strings*
)
*zone-strings*
)
(
hashlist
'
((
"yesterday"
.
yesterday
)
(
"today"
.
today
)
(
hashlist
'
((
"yesterday"
.
yesterday
)
(
"today"
.
today
)
...
@@ -137,6 +139,10 @@
...
@@ -137,6 +139,10 @@
(
year
(
date-divider
)
month
(
date-divider
)
day
(
year
(
date-divider
)
month
(
date-divider
)
day
hour
(
time-divider
)
(
minute
)
(
time-divider
)
(
secondp
)
hour
(
time-divider
)
(
minute
)
(
time-divider
)
(
secondp
)
(
am-pm
)
(
date-divider
)
(
zone
))
(
am-pm
)
(
date-divider
)
(
zone
))
(
year
(
date-divider
)
month
(
date-divider
)
day
(
date-time-divider
)
hour
(
time-divider
)
(
minute
)
(
time-divider
)
(
secondp
)
(
am-pm
)
(
date-divider
)
(
zone
))
(
month
(
date-divider
)
year
(
month
(
date-divider
)
year
hour
(
time-divider
)
(
minute
)
(
time-divider
)
(
secondp
)
hour
(
time-divider
)
(
minute
)
(
time-divider
)
(
secondp
)
(
am-pm
)
(
date-divider
)
(
zone
))
(
am-pm
)
(
date-divider
)
(
zone
))
...
@@ -396,6 +402,11 @@
...
@@ -396,6 +402,11 @@
(
defun
date-divider
(
character
)
(
defun
date-divider
(
character
)
(
and
(
characterp
character
)
(
and
(
characterp
character
)
(
member
character
date-dividers
:test
#'
char=
)))
(
member
character
date-dividers
:test
#'
char=
)))
(
defun
date-time-divider
(
character
)
(
and
(
characterp
character
)
(
member
character
date-dime-dividers
:test
#'
char=
)))
;;; Match-substring takes a string argument and tries to match it with
;;; Match-substring takes a string argument and tries to match it with
;;; the strings in one of the four hash tables: *weekday-strings*, *month-
;;; the strings in one of the four hash tables: *weekday-strings*, *month-
...
@@ -436,7 +447,10 @@
...
@@ -436,7 +447,10 @@
(
prev-char
(
if
(
=
string-index
start
)
(
prev-char
(
if
(
=
string-index
start
)
nil
nil
(
char
string
(
1-
string-index
)))))
(
char
string
(
1-
string-index
)))))
(
cond
((
alpha-char-p
next-char
)
(
cond
((
member
next-char
date-time-dividers
:test
#'
char=
)
(
push
(
cons
'date-time-divider
next-char
)
parts-list
)
(
incf
string-index
))
((
alpha-char-p
next-char
)
;; Alphabetic character - scan to the end of the substring.
;; Alphabetic character - scan to the end of the substring.
(
do
((
scan-index
(
1+
string-index
)
(
1+
scan-index
)))
(
do
((
scan-index
(
1+
string-index
)
(
1+
scan-index
)))
((
or
(
eq
scan-index
end
)
((
or
(
eq
scan-index
end
)
...
@@ -597,6 +611,7 @@
...
@@ -597,6 +611,7 @@
(
weekday
(
setf
(
decoded-time-dotw
parsed-values
)
form-value
))
(
weekday
(
setf
(
decoded-time-dotw
parsed-values
)
form-value
))
(
am-pm
(
deal-with-am-pm
form-value
parsed-values
))
(
am-pm
(
deal-with-am-pm
form-value
parsed-values
))
(
noon-midn
(
deal-with-noon-midn
form-value
parsed-values
))
(
noon-midn
(
deal-with-noon-midn
form-value
parsed-values
))
(
date-time-divider
0
)
(
special
(
funcall
form-value
parsed-values
))
(
special
(
funcall
form-value
parsed-values
))
(
t
(
error
"Unrecognized symbol in form list: ~A."
form-type
))))))
(
t
(
error
"Unrecognized symbol in form list: ~A."
form-type
))))))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment