Function: org-get-wdays

org-get-wdays is a byte-compiled function defined in org.el.gz.

Signature

(org-get-wdays TS &optional DELAY ZERO-DELAY)

Documentation

Get the deadline lead time appropriate for timestring TS.

When DELAY is non-nil, get the delay time for scheduled items instead of the deadline lead time. When ZERO-DELAY is non-nil and org-scheduled-delay-days is 0, enforce 0 as the delay, don't try to find the delay cookie in the scheduled timestamp.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-get-wdays (ts &optional delay zero-delay)
  "Get the deadline lead time appropriate for timestring TS.
When DELAY is non-nil, get the delay time for scheduled items
instead of the deadline lead time.  When ZERO-DELAY is non-nil
and `org-scheduled-delay-days' is 0, enforce 0 as the delay,
don't try to find the delay cookie in the scheduled timestamp."
  (let ((tv (if delay org-scheduled-delay-days
	      org-deadline-warning-days)))
    (cond
     ((or (and delay (< tv 0))
	  (and delay zero-delay (<= tv 0))
	  (and (not delay) (<= tv 0)))
      ;; Enforce this value no matter what
      (- tv))
     ((string-match "-\\([0-9]+\\)\\([hdwmy]\\)\\(\\'\\|>\\| \\)" ts)
      ;; lead time is specified.
      (floor (* (string-to-number (match-string 1 ts))
		(cdr (assoc (match-string 2 ts)
			    '(("d" . 1)    ("w" . 7)
			      ("m" . 30.4) ("y" . 365.25)
			      ("h" . 0.041667)))))))
     ;; go for the default.
     (t tv))))