*** empty log message ***
This commit is contained in:
parent
695c2d6e28
commit
b4cdc528b4
4 changed files with 14 additions and 14 deletions
22
amount.cc
22
amount.cc
|
|
@ -1141,21 +1141,19 @@ amount_t commodity_t::value(const std::time_t moment)
|
||||||
std::time_t age = 0;
|
std::time_t age = 0;
|
||||||
amount_t price;
|
amount_t price;
|
||||||
|
|
||||||
if (! history)
|
if (history)
|
||||||
return price;
|
for (history_map::reverse_iterator i = history->prices.rbegin();
|
||||||
|
i != history->prices.rend();
|
||||||
for (history_map::reverse_iterator i = history->prices.rbegin();
|
i++)
|
||||||
i != history->prices.rend();
|
if (moment == 0 || std::difftime(moment, (*i).first) >= 0) {
|
||||||
i++)
|
age = (*i).first;
|
||||||
if (moment == 0 || std::difftime(moment, (*i).first) >= 0) {
|
price = (*i).second;
|
||||||
age = (*i).first;
|
break;
|
||||||
price = (*i).second;
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (updater)
|
if (updater)
|
||||||
(*updater)(*this, moment, age,
|
(*updater)(*this, moment, age,
|
||||||
(history->prices.size() > 0 ?
|
(history && history->prices.size() > 0 ?
|
||||||
(*history->prices.rbegin()).first : 0), price);
|
(*history->prices.rbegin()).first : 0), price);
|
||||||
|
|
||||||
return price;
|
return price;
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,8 @@ void quotes_by_script::operator()(commodity_t& commodity,
|
||||||
success = false;
|
success = false;
|
||||||
if (pclose(fp) != 0)
|
if (pclose(fp) != 0)
|
||||||
success = false;
|
success = false;
|
||||||
|
} else {
|
||||||
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success && buf[0]) {
|
if (success && buf[0]) {
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,4 @@ else
|
||||||
limit=""
|
limit=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ledger -VQ $switch $limit -s -S "-AT" balance $accts
|
ledger -VQ $switch $limit -s -S "-UT" balance $accts
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,4 @@ else
|
||||||
limit=""
|
limit=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ledger -VQ $switch $limit -s -S "-AT" balance $accts
|
ledger -VQ $switch $limit -s -S "-UT" balance $accts
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue