Handbook
Glossary
report-anchor ( str -- timestamp )
Vocabulary
metar
.
private
Inputs
str
an
object
Outputs
timestamp
an
object
Definition
USING:
ascii
calendar
calendar.parser
kernel
namespaces
regexp
sequences
splitting
;
IN:
metar.private
::
report-anchor
( str -- timestamp )
report-reference-time
get
[
now-utc
]
unless*
:>
reference! str
[
blank?
]
split-when
harvest
:>
tokens tokens
?first
[
R/ \d{4}\/\d{2}\/\d{2}/
matches?
]
[
f
]
if*
[
tokens
first
"/"
"-"
replace
tokens
second
"T"
swap
append
append
":00Z"
append
rfc3339>timestamp
reference!
]
when
str
report-tokens
[
re-timestamp
matches?
]
find
nip
[
reference
parse-timestamp-at
]
[
reference
]
if*
;