From e2a22cb8c245b857e39417eb47b543ecf7204573 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 19 Mar 2012 03:51:07 -0500 Subject: Allow --input-date-format to specify separators Fixes #650 --- src/times.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/times.cc') 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 > 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(new date_io_t(format, true))); + convert_separators_to_slashes = false; } void times_initialize() -- cgit v1.2.3