
Ilya Bobir wrote:
General -------
What is so different about
time_duration td; cin >> td;
from
int v; cin >> v;
that makes you discuss an alternative error reporting strategy for the time duration input facet?
Because apparently not everyone is happy with the current strategy.
%H in an output facet --------------------- The hours value is converted into a string. There is a BOOST_ASSERT that checks that the value is no longer than 2 characters. At the same time a zero is perpended if the value is shorter than 2 characters.
Note that there is no check for the value of 23 or 24. Just for the length of 2 characters.
Technically, this check is intended to ensure that the formatted string will be parsed back with the %H specifier. That will hold if hours string is no longer than 2 characters.
%H in an output facet --------------------- A continuous sequence of digits no longer than 2 is read from a stream. If there is less than 2 digits it is an error. Read digits are converted into a number. Actually it means that the current behavior is wrong with regard to the ptime or time period.
What exactly is wrong?
%H in an input facet for a ptime bug ------------------------------------ The following code
[snip]
Gives me this output on MS cl:
2009-Jun-17 04:14:00 fail is false
While it would have failed to parse the input value, in my opinion.
I believe it's not a bug. The read date is normalized correctly.