Boost logo

Boost :

From: Michael Fawcett (michael.fawcett_at_[hidden])
Date: 2007-12-11 00:01:31


On Dec 10, 2007 10:28 PM, Jeff Garland <jeff_at_[hidden]> wrote:
> Mark Van Dijk wrote:
> > The following code snippet produces an ASSERT on my machine running
> > WinXP (sp2) with VS8 (sp1) with boost v1.34.1:
> >
> >
> > boost::posix_time::time_duration t(24, 0, 0);
> > std::cout << t << std::end;
> >
> >
> > The assertion occurs because there is a check in the underlying CRT that
> > verifies the hours portion is between 0 and 23 inclusive. Is this
> > something that might be fixed in boost 1.35?
>
> Well, I don't know what the problem is, but it isn't that the library
> restricts you to 24 hours. If you look in test/posix_time/testduration.cpp
> you'll see this test:
>
> time_duration tdl2(2000000, 0, 0, 0);
> check("2000000 hours", tdl2.hours() == 2000000);
>
> among others. And it clearly passes on VC8. So, I think you must have a
> compilation problem or something else going on.

I can confirm that I have run into this issue as well. I can post a
code snippet from my work computer tomorrow.

My 'workaround' was to simply use 23 hours, 59 minutes, and 59
seconds, since we didn't require resolution greater than that, but it
was definitely annoying.

--Michael Fawcett


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk