[posix_time][date_time] Another I/O error?

Hi all,
I upgraded to boost 1.33.1 and I started experiencing problems with the
following simple program while building with Visual Studio 2005.
#include <iostream>
#include

Bogdan M. wrote:
Hi all,
I upgraded to boost 1.33.1 and I started experiencing problems with the following simple program while building with Visual Studio 2005.
#include <iostream> #include
void main() { { std::cout << boost::posix_time::second_clock::universal_time(); } std::cout << std::endl; }
While printing the current time, the program crashes in Microsoft's 'xutility' header file (line 197) while trying to clean up some temporary strings created in time_facet.hpp (line 308), immediately after running boost::algorithm::replace_all(format, ss.str(), ""); I suspect the third parameter is the issue here (should it be surrounded explicitly with std::string("")?!).
Has anyone else encountered this problem.
I'm not aware of anyone else having this problem -- which doesn't mean they aren't. Anyway, the "" can't be std::string b/c it might be std::wstring. I've added string algorithms in the header since replace_all comes from there. Jeff

Hi Jeff, Thanks for your prompt answer. What I meant was to surround "" with something like: string_type ("") where string_type is a template-based type defined in the surrounding time_facet class. Nevertheless, I tested a little bit more the code and it turned out that the crash is due to ss.str() in the same line (time_facet.hpp:308). Changing the code to : boost::algorithm::replace_all(format, string_type (ss.str()), // <<<<<<<< use explicitly the standard string ""); seems to do the job. What worries me is that the original/official version of the code looks correct. I checked with some folks using the same deployment(e.g., boost 1.33.1 & Visual Studio 2005) and they have the same problem with the sample I posted. I am wondering whether we made a mistake while installing this particular version of boost or whether there is indeed something unusual with the way the compiler interprets the code in time_facet.hpp. Would it be possible for you to see whether the program I posted works in your Visual Studio 2005 setup? Thanks, Bogdan _______________________________________________________ Jeff Garland wrote: I'm not aware of anyone else having this problem -- which doesn't mean they aren't. Anyway, the "" can't be std::string b/c it might be std::wstring. I've added string algorithms in the header since replace_all comes from there. Jeff

Bogdan M. wrote:
Hi Jeff, Thanks for your prompt answer. What I meant was to surround "" with something like:
string_type ("")
where string_type is a template-based type defined in the surrounding time_facet class.
Nevertheless, I tested a little bit more the code and it turned out that the crash is due to ss.str() in the same line (time_facet.hpp:308). Changing the code to :
boost::algorithm::replace_all(format, string_type (ss.str()), // <<<<<<<< use explicitly the standard string "");
seems to do the job.
What worries me is that the original/official version of the code looks correct. I checked with some folks using the same deployment(e.g., boost 1.33.1 & Visual Studio 2005) and they have the same problem with the sample I posted.
VS 2005 was released after 1.33.1 although we were regression testing on beta versions.
I am wondering whether we made a mistake while installing this particular version of boost or whether there is indeed something unusual with the way the compiler interprets the code in time_facet.hpp.
It's coming back to me now -- stupid me for relying on my memory -- completely forgotten even though it was just a few months. This problem was reported right after vc8 was released. We concluded that this was a serious problem in vc8 standard library -- someone reported it to MS. The following mails from the list might be helpful. http://lists.boost.org/Archives/boost/2006/02/101042.php http://lists.boost.org/Archives/boost/2006/02/101109.php http://lists.boost.org/Archives/boost/2006/02/101122.php Long story short is that if you pickup a few files from the current CVS head (see last link) things should be mostly better. Note, I'm NOT going to guarantee that it is 100% -- as I recall there were a couple code paths I could not easily fix. Please complain to your vendor for a bug fix -- the problem in their library is serious and needs to be fixed.
Would it be possible for you to see whether the program I posted works in your Visual Studio 2005 setup?
Nope -- I don't develop date-time on Windows. Jeff
participants (2)
-
Bogdan M.
-
Jeff Garland