diff options
author | John Wiegley <johnw@newartisans.com> | 2009-03-08 04:20:33 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-03-08 04:20:33 -0400 |
commit | db70bb1d044a867cd517728fdf03a1b12f27bbc8 (patch) | |
tree | 719df67a10411ebdcb736929fbb739c5d61b1b63 /src/times.cc | |
parent | 77faaa926f06dc10cab65d08e0d35836d4a273a6 (diff) | |
download | fork-ledger-db70bb1d044a867cd517728fdf03a1b12f27bbc8.tar.gz fork-ledger-db70bb1d044a867cd517728fdf03a1b12f27bbc8.tar.bz2 fork-ledger-db70bb1d044a867cd517728fdf03a1b12f27bbc8.zip |
Added support for "today" as a time period
Diffstat (limited to 'src/times.cc')
-rw-r--r-- | src/times.cc | 12 |
1 files changed, 11 insertions, 1 deletions
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")) { |