diff options
-rw-r--r-- | datetime.cc | 14 | ||||
-rw-r--r-- | walk.cc | 11 |
2 files changed, 22 insertions, 3 deletions
diff --git a/datetime.cc b/datetime.cc index 0d39d3b3..70b36279 100644 --- a/datetime.cc +++ b/datetime.cc @@ -47,8 +47,17 @@ std::time_t interval_t::first(const std::time_t moment) } std::time_t temp; - while (std::difftime(moment, temp = increment(quant)) > 0) +#if DEBUG_LEVEL >= RELEASE + int cutoff = 10000; +#endif + while (std::difftime(moment, temp = increment(quant)) > 0) { + if (quant == temp) + break; quant = temp; +#if DEBUG_LEVEL >= RELEASE + assert(--cutoff > 0); +#endif + } } return quant; @@ -90,7 +99,8 @@ static void parse_inclusion_specifier(const std::string& word, struct std::tm when; if (! parse_date_mask(word.c_str(), &when)) - throw interval_expr_error("Could not parse 'in' date mask"); + throw interval_expr_error(std::string("Could not parse date mask: ") + + word); when.tm_hour = 0; when.tm_min = 0; @@ -275,9 +275,18 @@ void interval_transactions::operator()(transaction_t& xact) } std::time_t temp; +#if DEBUG_LEVEL >= RELEASE + int cutoff = 10000; +#endif while (std::difftime(xact.entry->date, - temp = interval.increment(quant)) > 0) + temp = interval.increment(quant)) > 0) { + if (quant == temp) + break; quant = temp; +#if DEBUG_LEVEL >= RELEASE + assert(--cutoff > 0); +#endif + } interval.begin = quant; } |