Function: org-matcher-time

org-matcher-time is a byte-compiled function defined in org-macs.el.gz.

Signature

(org-matcher-time S)

Documentation

Interpret a time comparison value S as a floating point time.

S can be an Org time stamp, a modifier, e.g., "<+2d>", or the following special strings: "<now>", "<today>",
"<tomorrow>", and "<yesterday>".

Return 0. if S is not recognized as a valid value.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-macs.el.gz
(defun org-matcher-time (s)
  "Interpret a time comparison value S as a floating point time.

S can be an Org time stamp, a modifier, e.g., \"<+2d>\", or the
following special strings: \"<now>\", \"<today>\",
\"<tomorrow>\", and \"<yesterday>\".

Return 0. if S is not recognized as a valid value."
  (let ((today (float-time (org-encode-time
                            (append '(0 0 0) (nthcdr 3 (decode-time)))))))
    (save-match-data
      (cond
       ((string= s "<now>") (float-time))
       ((string= s "<today>") today)
       ((string= s "<tomorrow>") (+ 86400.0 today))
       ((string= s "<yesterday>") (- today 86400.0))
       ((string-match "\\`<\\([-+][0-9]+\\)\\([hdwmy]\\)>\\'" s)
	(+ (if (string= (match-string 2 s) "h") (float-time) today)
	   (* (string-to-number (match-string 1 s))
	      (cdr (assoc (match-string 2 s)
			  '(("h" . 3600.0)
			    ("d" . 86400.0)   ("w" . 604800.0)
			    ("m" . 2678400.0) ("y" . 31557600.0)))))))
       ((string-match org-ts-regexp0 s) (org-2ft s))
       (t 0.)))))