summaryrefslogtreecommitdiff
path: root/src/value.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-10-25 04:37:11 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-10-25 05:01:47 -0400
commitfc84eeb358f13b7c2b2668917692da26af001901 (patch)
treecfc4540c1b7805a17425675c1143d7a2d748b42f /src/value.cc
parent588f2ef2f51d7bdf209820bfb244034863601939 (diff)
downloadfork-ledger-fc84eeb358f13b7c2b2668917692da26af001901.tar.gz
fork-ledger-fc84eeb358f13b7c2b2668917692da26af001901.tar.bz2
fork-ledger-fc84eeb358f13b7c2b2668917692da26af001901.zip
Rewrote the way date and time I/O is managed
Diffstat (limited to 'src/value.cc')
-rw-r--r--src/value.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/value.cc b/src/value.cc
index 0f831cdf..6ce46f5c 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -984,7 +984,7 @@ void value_t::in_place_cast(type_t cast_type)
set_datetime(datetime_t(as_date(), time_duration(0, 0, 0, 0)));
return;
case STRING:
- set_string(format_date(as_date(), string("%Y-%m-%d")));
+ set_string(format_date(as_date(), FMT_WRITTEN));
return;
default:
break;
@@ -996,7 +996,7 @@ void value_t::in_place_cast(type_t cast_type)
set_date(as_datetime().date());
return;
case STRING:
- set_string(format_datetime(as_datetime(), string("%Y-%m-%d %H:%M:%S")));
+ set_string(format_datetime(as_datetime(), FMT_WRITTEN));
return;
default:
break;
@@ -1495,16 +1495,17 @@ void value_t::print(std::ostream& out,
case DATETIME:
if (date_format)
- out << format_datetime(as_datetime(), *date_format);
+ out << format_datetime(as_datetime(), FMT_CUSTOM,
+ date_format->c_str());
else
- out << format_datetime(as_datetime());
+ out << format_datetime(as_datetime(), FMT_WRITTEN);
break;
case DATE:
if (date_format)
- out << format_date(as_date(), *date_format);
+ out << format_date(as_date(), FMT_CUSTOM, date_format->c_str());
else
- out << format_date(as_date());
+ out << format_date(as_date(), FMT_WRITTEN);
break;
case INTEGER:
@@ -1579,10 +1580,10 @@ void value_t::dump(std::ostream& out, const bool relaxed) const
break;
case DATETIME:
- out << '[' << format_datetime(as_datetime()) << ']';
+ out << '[' << format_datetime(as_datetime(), FMT_WRITTEN) << ']';
break;
case DATE:
- out << '[' << format_date(as_date()) << ']';
+ out << '[' << format_date(as_date(), FMT_WRITTEN) << ']';
break;
case INTEGER: