Opened 12 years ago
Last modified 12 years ago
#4870 new Patches
ISO Timestamp Parsing Bug
Reported by: | Owned by: | az_sw_dude | |
---|---|---|---|
Milestone: | To Be Determined | Component: | date_time |
Version: | Boost 1.44.0 | Severity: | Problem |
Keywords: | Cc: |
Description
boost::posix_time::from_iso_string() converts "20100713" into "20100713T201007.300000" which is obviously wrong.
The error is caused by boost::date_time::split().
The attached patch corrects split() so that an exception is thrown later in parse_delimited_time_duration().
The problem is reproducible in Boost 1.42.0 and 1.44.0.
This simple example demonstrates the issue:
const boost::posix_time::ptime time=boost::posix_time::from_iso_string("20100713"); std::cout << "Converted: " << boost::posix_time::to_iso_string(time) << std::endl;
Converted: 20100713T201007.300000
Maybe someone can apply this patch.
Attachments (1)
Change History (5)
by , 12 years ago
Attachment: | boost_1_42_0-DateTimeIsoParsingCheck.patch added |
---|
comment:1 by , 12 years ago
Type: | Bugs → Patches |
---|
comment:2 by , 12 years ago
While the attached patch does work as expected, perhaps whether the resulting exception is the correct one should be considered. If not, that will need to be change as well.
Also, the wider design issue of whether to actually check for correct input at all. If yes, what other incorrectly formatted input string would need to be consider and whether it's being correctly check currently.
comment:4 by , 12 years ago
I've applied the patch - now let's talk about what else is needed to fix the problem.
First - should we have a test case for this?
Second - what is the desired behavior?
Patch against Boost 1.42.0