Function: diary-icalendar-parse-time
diary-icalendar-parse-time is a byte-compiled function defined in
diary-icalendar.el.gz.
Signature
(diary-icalendar-parse-time)
Documentation
Parse diary time string in the current restriction.
If a time specification is found, move the current restriction past it, and return a list (START END), where START and END are decoded-time values containing the hours and minutes slots parsed from the time specification. END may be nil if no end time was specified.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/diary-icalendar.el.gz
(defun di:parse-time ()
"Parse diary time string in the current restriction.
If a time specification is found, move the current restriction past it,
and return a list (START END), where START and END are decoded-time
values containing the hours and minutes slots parsed from the time
specification. END may be nil if no end time was specified."
(goto-char (point-min))
(let ((regexp di:time-regexp)
(case-fold-search t))
(when di:export-linewise
;; In this case, only look for a time following whitespace,
;; at the beginning of a continuation line of the full entry:
(setq regexp (concat "^[[:space:]]+" di:time-regexp)))
(when (re-search-forward regexp (line-end-position) t)
(let* ((start-hh (string-to-number (match-string 11)))
(start-am/pm (when (match-string 13)
(upcase (match-string 13))))
(start-hours (if (and (equal start-am/pm "PM") (< start-hh 12))
(+ 12 start-hh)
start-hh))
(start-minutes (string-to-number (or (match-string 12) "0")))
(start
(when (and start-hours start-minutes)
(make-decoded-time :hour start-hours
:minute start-minutes
:second 0)))
(end-hh (when (match-string 21)
(string-to-number (match-string 21))))
(end-am/pm (when (match-string 23)
(upcase (match-string 23))))
(end-hours (if (and end-hh (equal end-am/pm "PM") (< end-hh 12))
(+ 12 end-hh)
end-hh))
(end-minutes (when end-hours
(string-to-number (or (match-string 22) "0"))))
(end (when (and end-hours end-minutes)
(make-decoded-time :hour end-hours
:minute end-minutes
:second 0))))
(narrow-to-region (match-end 0) (point-max))
;; Return the times:
(list start end)))))