>From d19778b3fc624e14237d69cc76a4aa9cb8450697 Mon Sep 17 00:00:00 2001
From: Ilya Shlyakhter
Date: Fri, 30 Mar 2012 21:19:12 -0400
Subject: [PATCH] Time specifications: Allow specifying relative times
* org.el (org-parse-time-string): Allow strings supported by tags/properties
matcher (eg , , <-7d>) if the time starts with < and ends
with >. This means that e.g. in the clocktable parameters you can specify
:tstart "<-1w>" :tend "".
TINYCHANGE
---
lisp/org.el | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 4d2ae87..995dffd 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16016,16 +16016,19 @@ When SHOW-ALL is nil, only return the current occurrence of a time stamp."
This should be a lot faster than the normal `parse-time-string'.
If time is not given, defaults to 0:00. However, with optional NODEFAULT,
hour and minute fields will be nil if not given."
- (if (string-match org-ts-regexp0 s)
- (list 0
- (if (or (match-beginning 8) (not nodefault))
- (string-to-number (or (match-string 8 s) "0")))
- (if (or (match-beginning 7) (not nodefault))
- (string-to-number (or (match-string 7 s) "0")))
- (string-to-number (match-string 4 s))
- (string-to-number (match-string 3 s))
- (string-to-number (match-string 2 s))
- nil nil nil)
+ (cond
+ ((string-match "^<.+>$" s)
+ (decode-time (seconds-to-time (org-matcher-time s))))
+ ((string-match org-ts-regexp0 s)
+ (list 0
+ (if (or (match-beginning 8) (not nodefault))
+ (string-to-number (or (match-string 8 s) "0")))
+ (if (or (match-beginning 7) (not nodefault))
+ (string-to-number (or (match-string 7 s) "0")))
+ (string-to-number (match-string 4 s))
+ (string-to-number (match-string 3 s))
+ (string-to-number (match-string 2 s))
+ nil nil nil))
(error "Not a standard Org-mode time string: %s" s)))
(defun org-timestamp-up (&optional arg)
--
1.7.9.3