Boost logo

Boost Users :

From: Michael Lin (michael.lin_at_[hidden])
Date: 2005-12-08 01:41:05


Hi all,

I come across a bug in boost::posix_time::time_from_string();

try
{
    ptime t1(time_from_string("2005-01-01"));
    cout << to_simple_string(t1) << endl;
}
catch (...)
{
    cout << "exception thrown" << endl;
}

The above code will strangely output: "2005-Mar-25 13:01:01"

time_from_string() will parse "2005-01-01 12", "2005-01-01 12:23" and
"2005-01-01 12:23:33" correctly.

It will even parse "2005-01-01 34" to the next day and output
"2005-Jan-02 10:00:00"

Does anyone have a fix for this bug? It should either parse correctly or it
should throw an exception.

Thanks
Michael


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net