diff options
-rw-r--r-- | src/times.cc | 11 | ||||
-rw-r--r-- | test/regress/751B2357.test | 17 |
2 files changed, 25 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() diff --git a/test/regress/751B2357.test b/test/regress/751B2357.test new file mode 100644 index 00000000..2b0f9a16 --- /dev/null +++ b/test/regress/751B2357.test @@ -0,0 +1,17 @@ +01.10.2011 4b4e2a89 + ef9d9585:efa1fb7b:22845e93:0e3763f0 2,00 A + 2c166ff7:d34e3aa1:8a5075b3:56f3c726 + +01.10.2011 15983995 + eb78b6c0:a2857de3:d6d8ea07:6688fc4e 2,58 A + ba3ffe56:c3ba36a5:aa63399f:e9e1d043 + +test print --date-format=%d.%m.%Y --input-date-format=%d.%m.%Y +01.10.2011 4b4e2a89 + ef9d9585:efa1fb7b:22845e93:0e3763f0 2,00 A + 2c166ff7:d34e3aa1:8a5075b3:56f3c726 + +01.10.2011 15983995 + eb78b6c0:a2857de3:d6d8ea07:6688fc4e 2,58 A + ba3ffe56:c3ba36a5:aa63399f:e9e1d043 +end test |