summaryrefslogtreecommitdiff
path: root/src/times.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-19 03:51:07 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-03-19 03:51:07 -0500
commite2a22cb8c245b857e39417eb47b543ecf7204573 (patch)
tree519e3216fc691168d21d9ce0e3a0803c1ed97b20 /src/times.cc
parent2ade6c07fd5050811fc2d8b23d2b104376900cbb (diff)
downloadfork-ledger-e2a22cb8c245b857e39417eb47b543ecf7204573.tar.gz
fork-ledger-e2a22cb8c245b857e39417eb47b543ecf7204573.tar.bz2
fork-ledger-e2a22cb8c245b857e39417eb47b543ecf7204573.zip
Allow --input-date-format to specify separators
Fixes #650
Diffstat (limited to 'src/times.cc')
-rw-r--r--src/times.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/times.cc b/src/times.cc
index 21ec1859..3c556a47 100644
--- a/src/times.cc
+++ b/src/times.cc
@@ -197,6 +197,8 @@ namespace {
std::deque<shared_ptr<date_io_t> > readers;
+ bool convert_separators_to_slashes = true;
+
date_t parse_date_mask_routine(const char * date_str, date_io_t& io,
date_traits_t * traits = NULL)
{
@@ -205,9 +207,11 @@ namespace {
char buf[128];
std::strcpy(buf, date_str);
- for (char * p = buf; *p; p++)
- if (*p == '.' || *p == '-')
- *p = '/';
+ if (convert_separators_to_slashes) {
+ for (char * p = buf; *p; p++)
+ if (*p == '.' || *p == '-')
+ *p = '/';
+ }
date_t when = io.parse(buf);
@@ -1775,6 +1779,7 @@ void set_date_format(const char * format)
void set_input_date_format(const char * format)
{
readers.push_front(shared_ptr<date_io_t>(new date_io_t(format, true)));
+ convert_separators_to_slashes = false;
}
void times_initialize()