#7041 closed Bugs (fixed)
time_point.hpp depends on Boost.System
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | Boost 1.51.0 | Component: | chrono |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: |
Description
Hello,
Problem: The file boost/chrono/time_point.hpp #includes <boost/chrono/detail/system.hpp>, and it doesn't appear to need it. This creates an unnecessary dependency on Boost.System, even though no clock provided by Boost.Chrono is used.
Proposed solution: remove #include <boost/chrono/detail/system.hpp> from boost/chrono/time_point.hpp.
Rationale: Suppose I want to create my own clock class, and in it among other things I would like to typedef a time_point<...>.
struct MyClock { typedef int64_t rep; typedef boost::milli period; typedef boost::chrono::duration<rep,period> duration; typedef boost::chrono::time_point<MyClock,duration> time_point; static bool const is_steady = false; static time_point now(); };
Now, for this to work it is necessary to #include <boost/chrono/time_point.hpp>. Including it causes a dependency on Boost.System.
Cheers, Kris
Attachments (1)
Change History (6)
by , 10 years ago
Attachment: | 7041.patch added |
---|
comment:2 by , 10 years ago
Yes, the patch + #define BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING fixes it. Thanks for looking into this.
I would like to ask, why would you want <boost/chrono/detail/system.hpp> #included in time_point.hpp? I would think time_point.hpp should *not* depend on Boost.System regardless of #defining BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING. Am I missing something?
Cheers, Kris
comment:3 by , 10 years ago
Milestone: | To Be Determined → Boost 1.51.0 |
---|
comment:5 by , 10 years ago
I didn't understood the real problem. I have removed the include <boost/chrono/detail/system.hpp> as not needed.
Committed in trunk revision 79381. Committed in release branch revision 79382.
Please, could you tell me if the attached patch solves the issue when BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING is defined?