summaryrefslogtreecommitdiff
path: root/valexpr.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-08-07 21:03:25 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-08-07 21:03:25 -0400
commitc6c0179545b4572b7abf46957abd453022f9e213 (patch)
treef830c5f6ea7113551ff3372870fb2d7f5481d92d /valexpr.cc
parent5db1e1165b05ae56e0348a4634144072dfcace1f (diff)
downloadfork-ledger-c6c0179545b4572b7abf46957abd453022f9e213.tar.gz
fork-ledger-c6c0179545b4572b7abf46957abd453022f9e213.tar.bz2
fork-ledger-c6c0179545b4572b7abf46957abd453022f9e213.zip
got more reports working again
Diffstat (limited to 'valexpr.cc')
-rw-r--r--valexpr.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/valexpr.cc b/valexpr.cc
index b1b53974..2889c602 100644
--- a/valexpr.cc
+++ b/valexpr.cc
@@ -153,6 +153,8 @@ void node_t::compute(balance_t& result, const details_t& details) const
case DATE:
if (details.entry)
result = (unsigned int) details.entry->date;
+ else
+ result = (unsigned int) std::time(NULL);
break;
case CLEARED:
@@ -207,12 +209,20 @@ void node_t::compute(balance_t& result, const details_t& details) const
left->compute(result, details);
std::time_t moment = -1;
- if (right && details.entry) {
+ if (right) {
switch (right->type) {
- case DATE: moment = details.entry->date; break;
+ case DATE:
+ if (details.entry)
+ moment = details.entry->date;
+ else
+ moment = std::time(NULL);
+ break;
+
default:
- throw compute_error("Invalid date passed to P(v,d)");
+ throw compute_error("Invalid date passed to P(value,date)");
}
+ } else {
+ moment = std::time(NULL);
}
result = result.value(moment);
break;