diff options
-rw-r--r-- | src/filters.cc | 4 | ||||
-rw-r--r-- | src/filters.h | 4 | ||||
-rw-r--r-- | src/times.h | 4 |
3 files changed, 8 insertions, 4 deletions
diff --git a/src/filters.cc b/src/filters.cc index 331073eb..f57f37e7 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -924,7 +924,7 @@ void interval_posts::operator()(post_t& post) report_subtotal(last_interval); if (generate_empty_posts) { - for (++last_interval; interval != last_interval; ++last_interval) { + for (++last_interval; last_interval < interval; ++last_interval) { // Generate a null posting, so the intervening periods can be // seen when -E is used, or if the calculated amount ends up being // non-zero @@ -940,7 +940,7 @@ void interval_posts::operator()(post_t& post) report_subtotal(last_interval); } - assert(interval == last_interval); + assert(last_interval <= interval); } else { last_interval = interval; } diff --git a/src/filters.h b/src/filters.h index e7a2eefa..d207d842 100644 --- a/src/filters.h +++ b/src/filters.h @@ -732,8 +732,8 @@ public: virtual void flush() { if (last_post && interval.duration) { - if (interval.is_valid()) - report_subtotal(interval); + if (last_interval && interval != last_interval) + report_subtotal(last_interval); subtotal_posts::flush(); } } diff --git a/src/times.h b/src/times.h index 39945824..a2680ae3 100644 --- a/src/times.h +++ b/src/times.h @@ -553,6 +553,10 @@ public: return (start == other.start && (! start || *start == *other.start)); } + bool operator<(const date_interval_t& other) const { + return (start == other.start && + (! start || *start < *other.start)); + } operator bool() const { return is_valid(); |