From db70bb1d044a867cd517728fdf03a1b12f27bbc8 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 8 Mar 2009 04:20:33 -0400 Subject: Added support for "today" as a time period --- src/times.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/times.cc b/src/times.cc index 6e67f2f7..147106db 100644 --- a/src/times.cc +++ b/src/times.cc @@ -272,6 +272,15 @@ namespace { std::sprintf(buf, "%04d", year); word = buf; } + else if (word == _("today")) { + if (begin) + *begin = CURRENT_DATE(); + if (end) { + *end = CURRENT_DATE(); + *end += gregorian::days(1); + } + return; + } parse_inclusion_specifier(word, begin, end); @@ -357,7 +366,8 @@ void interval_t::parse(std::istream& in) months = 3; else if (word == _("yearly")) years = 1; - else if (word == _("this") || word == _("last") || word == _("next")) { + else if (word == _("this") || word == _("last") || word == _("next") || + word == _("today")) { parse_date_words(in, word, &begin, &end); } else if (word == _("in")) { -- cgit v1.2.3