Function: org-parse-time-string

org-parse-time-string is a byte-compiled function defined in org-macs.el.

Signature

(org-parse-time-string S &optional NODEFAULT)

Documentation

Parse Org time string S.

If time is not given, defaults to 0:00. However, with optional NODEFAULT, hour and minute fields are nil if not given.

Throw an error if S does not contain a valid Org time string. Note that the first match for YYYY-MM-DD will be used (e.g.,
"-52000-02-03" will be taken as "2000-02-03").

This should be a lot faster than the parse-time-string.

Source Code

;; Defined in ~/.emacs.d/elpa/org-9.8.2/org-macs.el
(defun org-parse-time-string (s &optional nodefault)
  "Parse Org time string S.

If time is not given, defaults to 0:00.  However, with optional
NODEFAULT, hour and minute fields are nil if not given.

Throw an error if S does not contain a valid Org time string.
Note that the first match for YYYY-MM-DD will be used (e.g.,
\"-52000-02-03\" will be taken as \"2000-02-03\").

This should be a lot faster than the `parse-time-string'."
  (unless (string-match org-ts-regexp0 s)
    (error "Not an Org time string: %s" s))
  (list 0
	(cond ((match-beginning 8) (string-to-number (match-string 8 s)))
	      (nodefault nil)
	      (t 0))
	(cond ((match-beginning 7) (string-to-number (match-string 7 s)))
	      (nodefault nil)
	      (t 0))
	(string-to-number (match-string 4 s))
	(string-to-number (match-string 3 s))
	(string-to-number (match-string 2 s))
	nil -1 nil))