Boost logo

Boost Users :

Subject: Re: [Boost-users] [date_time] posix_time::time_duration::operator<< fails for hours>23
From: Scott McCaskill (scott.mccaskill_at_[hidden])
Date: 2009-02-04 11:01:40


On Sun, Jan 13, 2008 at 11:11 AM, Soren Dreijer <admin_at_[hidden]
> wrote:

> I'm creating a posix_time::time_duration object based on the minutes()
> helper function. If I specify a large value, such as 2000, I get a
> time_duration of 33:20:00. Take a look at the following piece of code,
> though:
>
> time_duration td = minutes(2000);
> cout << to_simple_string(td); // OK
> cout << td; // Fails with an assertion in VS2008
>
> The latter call fails with the following assertion in strftime.c on line
> 658:
> _VALIDATE_RETURN( ( ( timeptr->tm_hour >=0 ) && ( timeptr->tm_hour <=
> 23 ) ), EINVAL, FALSE)
>
> Apparently, operator<< expands to _expandtime(), which doesn't allow values
> for the hour to be greater than 23. Is this intended behavior, or should I
> just always use to_simple_string() rather than the convenient operator<< ?
>
>
I'm seeing a similar problem, but did not see any replies to this. Does
anyone know the answer? I'm using boost 1.34.1; has this been fixed in a
newer version? There is no to_simple_string() method for this class, at
least not in this version of boost.



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