From ac5f42fd30538628c9eb9e448ef1782b72a9206b Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 14 Sep 2005 19:35:46 +0000 Subject: (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. --- datetime.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'datetime.cc') 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); -- cgit v1.2.3