summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/commodity.cc3
-rw-r--r--src/value.cc22
2 files changed, 16 insertions, 9 deletions
diff --git a/src/commodity.cc b/src/commodity.cc
index 49e82b53..b76c7896 100644
--- a/src/commodity.cc
+++ b/src/commodity.cc
@@ -637,7 +637,8 @@ bool compare_amount_commodities::operator()(const amount_t * left,
return false;
if (aleftcomm.details.date && arightcomm.details.date) {
- date_duration_t diff = *aleftcomm.details.date - *arightcomm.details.date;
+ gregorian::date_duration diff =
+ *aleftcomm.details.date - *arightcomm.details.date;
return diff.is_negative();
}
diff --git a/src/value.cc b/src/value.cc
index 3f70ab3d..797c144c 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -338,10 +338,13 @@ value_t& value_t::operator+=(const value_t& val)
case DATETIME:
switch (val.type()) {
case INTEGER:
- as_datetime_lval() += date_duration(val.as_long());
+ as_datetime_lval() +=
+ time_duration_t(0, 0, static_cast<time_duration_t::sec_type>(val.as_long()));
return *this;
case AMOUNT:
- as_datetime_lval() += date_duration(val.as_amount().to_long());
+ as_datetime_lval() +=
+ time_duration_t(0, 0, static_cast<time_duration_t::sec_type>
+ (val.as_amount().to_long()));
return *this;
default:
break;
@@ -351,10 +354,10 @@ value_t& value_t::operator+=(const value_t& val)
case DATE:
switch (val.type()) {
case INTEGER:
- as_date_lval() += date_duration_t(val.as_long());
+ as_date_lval() += gregorian::date_duration(val.as_long());
return *this;
case AMOUNT:
- as_date_lval() += date_duration_t(val.as_amount().to_long());
+ as_date_lval() += gregorian::date_duration(val.as_amount().to_long());
return *this;
default:
break;
@@ -466,10 +469,13 @@ value_t& value_t::operator-=(const value_t& val)
case DATETIME:
switch (val.type()) {
case INTEGER:
- as_datetime_lval() -= date_duration(val.as_long());
+ as_datetime_lval() -=
+ time_duration_t(0, 0, static_cast<time_duration_t::sec_type>(val.as_long()));
return *this;
case AMOUNT:
- as_datetime_lval() -= date_duration(val.as_amount().to_long());
+ as_datetime_lval() -=
+ time_duration_t(0, 0, static_cast<time_duration_t::sec_type>
+ (val.as_amount().to_long()));
return *this;
default:
break;
@@ -479,10 +485,10 @@ value_t& value_t::operator-=(const value_t& val)
case DATE:
switch (val.type()) {
case INTEGER:
- as_date_lval() -= date_duration_t(val.as_long());
+ as_date_lval() -= gregorian::date_duration(val.as_long());
return *this;
case AMOUNT:
- as_date_lval() -= date_duration_t(val.as_amount().to_long());
+ as_date_lval() -= gregorian::date_duration(val.as_amount().to_long());
return *this;
default:
break;