diff options
author | John Wiegley <johnw@newartisans.com> | 2005-09-14 19:35:46 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 02:41:18 -0400 |
commit | ac5f42fd30538628c9eb9e448ef1782b72a9206b (patch) | |
tree | a4d8e671524d949b88c4042e4660c9aaa6b8ab5f /datetime.cc | |
parent | 8291ec951e22b7ad859cc287f28f80875505aeaa (diff) | |
download | fork-ledger-ac5f42fd30538628c9eb9e448ef1782b72a9206b.tar.gz fork-ledger-ac5f42fd30538628c9eb9e448ef1782b72a9206b.tar.bz2 fork-ledger-ac5f42fd30538628c9eb9e448ef1782b72a9206b.zip |
(parse_inclusion_specifier): When a specific day is given as a date
specifier, set the end of the "range" to be the beginning of the next
day, rather than the beginning of the next month.
Diffstat (limited to 'datetime.cc')
-rw-r--r-- | datetime.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/datetime.cc b/datetime.cc index d916a2d1..07d19624 100644 --- a/datetime.cc +++ b/datetime.cc @@ -116,6 +116,7 @@ static void parse_inclusion_specifier(const std::string& word, bool saw_year = true; bool saw_mon = true; + bool saw_day = true; if (when.tm_year == -1) { when.tm_year = now_year; @@ -127,13 +128,19 @@ static void parse_inclusion_specifier(const std::string& word, } else { saw_year = false; // don't increment by year if month used } - if (when.tm_mday == -1) + if (when.tm_mday == -1) { when.tm_mday = 1; + saw_day = false; + } else { + saw_mon = false; // don't increment by month if day used + saw_year = false; // don't increment by year if day used + } if (begin) { *begin = std::mktime(&when); if (end) - *end = interval_t(0, saw_mon ? 1 : 0, saw_year ? 1 : 0).increment(*begin); + *end = interval_t(saw_day ? 86400 : 0, saw_mon ? 1 : 0, + saw_year ? 1 : 0).increment(*begin); } else if (end) { *end = std::mktime(&when); |