Fixed several time and date duration type uses
This commit is contained in:
parent
6b557f810e
commit
b2ba07b90c
2 changed files with 16 additions and 9 deletions
|
|
@ -637,7 +637,8 @@ bool compare_amount_commodities::operator()(const amount_t * left,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (aleftcomm.details.date && arightcomm.details.date) {
|
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();
|
return diff.is_negative();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
22
src/value.cc
22
src/value.cc
|
|
@ -338,10 +338,13 @@ value_t& value_t::operator+=(const value_t& val)
|
||||||
case DATETIME:
|
case DATETIME:
|
||||||
switch (val.type()) {
|
switch (val.type()) {
|
||||||
case INTEGER:
|
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;
|
return *this;
|
||||||
case AMOUNT:
|
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;
|
return *this;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -351,10 +354,10 @@ value_t& value_t::operator+=(const value_t& val)
|
||||||
case DATE:
|
case DATE:
|
||||||
switch (val.type()) {
|
switch (val.type()) {
|
||||||
case INTEGER:
|
case INTEGER:
|
||||||
as_date_lval() += date_duration_t(val.as_long());
|
as_date_lval() += gregorian::date_duration(val.as_long());
|
||||||
return *this;
|
return *this;
|
||||||
case AMOUNT:
|
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;
|
return *this;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -466,10 +469,13 @@ value_t& value_t::operator-=(const value_t& val)
|
||||||
case DATETIME:
|
case DATETIME:
|
||||||
switch (val.type()) {
|
switch (val.type()) {
|
||||||
case INTEGER:
|
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;
|
return *this;
|
||||||
case AMOUNT:
|
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;
|
return *this;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -479,10 +485,10 @@ value_t& value_t::operator-=(const value_t& val)
|
||||||
case DATE:
|
case DATE:
|
||||||
switch (val.type()) {
|
switch (val.type()) {
|
||||||
case INTEGER:
|
case INTEGER:
|
||||||
as_date_lval() -= date_duration_t(val.as_long());
|
as_date_lval() -= gregorian::date_duration(val.as_long());
|
||||||
return *this;
|
return *this;
|
||||||
case AMOUNT:
|
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;
|
return *this;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue