diff options
author | Alexis Hildebrandt <afh@surryhill.net> | 2013-09-07 09:38:13 +0200 |
---|---|---|
committer | Alexis Hildebrandt <afh@surryhill.net> | 2013-09-07 09:38:13 +0200 |
commit | 30b6acb0b012fe0bb37ced1e15dc3315812960d3 (patch) | |
tree | e22f6492b5414a2a6ce8421ecab27b7f89f742f6 /src/amount.cc | |
parent | 8b80e5efc7c47f7813259d2a40a6cc25a440142a (diff) | |
download | fork-ledger-30b6acb0b012fe0bb37ced1e15dc3315812960d3.tar.gz fork-ledger-30b6acb0b012fe0bb37ced1e15dc3315812960d3.tar.bz2 fork-ledger-30b6acb0b012fe0bb37ced1e15dc3315812960d3.zip |
Apply --time-colon option only to time commodities
See #989
Diffstat (limited to 'src/amount.cc')
-rw-r--r-- | src/amount.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/amount.cc b/src/amount.cc index 4fe73546..6ff2f4dd 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -196,8 +196,8 @@ namespace { for (const char * p = buf; *p; p++) { if (*p == '.') { - if (commodity_t::time_colon_by_default || - (comm && comm->has_flags(COMMODITY_STYLE_TIME_COLON))) + if (("h" == comm->symbol() || "m" == comm->symbol()) && (commodity_t::time_colon_by_default || + (comm && comm->has_flags(COMMODITY_STYLE_TIME_COLON)))) out << ':'; else if (commodity_t::decimal_comma_by_default || (comm && comm->has_flags(COMMODITY_STYLE_DECIMAL_COMMA))) @@ -213,8 +213,8 @@ namespace { out << *p; if (integer_digits > 3 && --integer_digits % 3 == 0) { - if (commodity_t::time_colon_by_default || - (comm && comm->has_flags(COMMODITY_STYLE_TIME_COLON))) + if (("h" == comm->symbol() || "m" == comm->symbol()) && (commodity_t::time_colon_by_default || + (comm && comm->has_flags(COMMODITY_STYLE_TIME_COLON)))) out << ':'; else if (commodity_t::decimal_comma_by_default || (comm && comm->has_flags(COMMODITY_STYLE_DECIMAL_COMMA))) @@ -744,7 +744,7 @@ void amount_t::in_place_unreduce() } if (shifted) { - if ("h" == comm->symbol() && commodity_t::time_colon_by_default) { + if (("h" == comm->symbol() || "m" == comm->symbol()) && commodity_t::time_colon_by_default) { amount_t floored = tmp.floored(); amount_t precision = tmp - floored; if (precision < 0.0) { |