fixed a problem with interval strings that use only a beg or end date
This commit is contained in:
parent
b1aa1344ae
commit
5ad722fcdf
1 changed files with 37 additions and 33 deletions
70
walk.cc
70
walk.cc
|
|
@ -279,43 +279,47 @@ void interval_transactions::operator()(transaction_t& xact)
|
||||||
std::difftime(xact.entry->date, interval.end) >= 0))
|
std::difftime(xact.entry->date, interval.end) >= 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::time_t quant = interval.increment(interval.begin);
|
if (interval) {
|
||||||
if (std::difftime(xact.entry->date, quant) > 0) {
|
std::time_t quant = interval.increment(interval.begin);
|
||||||
if (last_xact) {
|
if (std::difftime(xact.entry->date, quant) > 0) {
|
||||||
start = interval.begin;
|
if (last_xact) {
|
||||||
finish = quant;
|
start = interval.begin;
|
||||||
flush();
|
finish = quant;
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! interval.seconds) {
|
||||||
|
struct std::tm * desc = std::localtime(&xact.entry->date);
|
||||||
|
if (interval.years)
|
||||||
|
desc->tm_mon = 0;
|
||||||
|
desc->tm_mday = 1;
|
||||||
|
desc->tm_hour = 0;
|
||||||
|
desc->tm_min = 0;
|
||||||
|
desc->tm_sec = 0;
|
||||||
|
quant = std::mktime(desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::time_t temp;
|
||||||
|
#if DEBUG_LEVEL >= RELEASE
|
||||||
|
int cutoff = 10000;
|
||||||
|
#endif
|
||||||
|
while (std::difftime(xact.entry->date,
|
||||||
|
temp = interval.increment(quant)) > 0) {
|
||||||
|
if (quant == temp)
|
||||||
|
break;
|
||||||
|
quant = temp;
|
||||||
|
#if DEBUG_LEVEL >= RELEASE
|
||||||
|
assert(--cutoff > 0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
interval.begin = quant;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! interval.seconds) {
|
subtotal_transactions::operator()(xact);
|
||||||
struct std::tm * desc = std::localtime(&xact.entry->date);
|
} else {
|
||||||
if (interval.years)
|
(*handler)(xact);
|
||||||
desc->tm_mon = 0;
|
|
||||||
desc->tm_mday = 1;
|
|
||||||
desc->tm_hour = 0;
|
|
||||||
desc->tm_min = 0;
|
|
||||||
desc->tm_sec = 0;
|
|
||||||
quant = std::mktime(desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::time_t temp;
|
|
||||||
#if DEBUG_LEVEL >= RELEASE
|
|
||||||
int cutoff = 10000;
|
|
||||||
#endif
|
|
||||||
while (std::difftime(xact.entry->date,
|
|
||||||
temp = interval.increment(quant)) > 0) {
|
|
||||||
if (quant == temp)
|
|
||||||
break;
|
|
||||||
quant = temp;
|
|
||||||
#if DEBUG_LEVEL >= RELEASE
|
|
||||||
assert(--cutoff > 0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
interval.begin = quant;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
subtotal_transactions::operator()(xact);
|
|
||||||
|
|
||||||
last_xact = &xact;
|
last_xact = &xact;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue