Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#7041 closed Bugs (fixed)

time_point.hpp depends on Boost.System

Reported by: 1czajnik@… Owned by: viboes
Milestone: Boost 1.51.0 Component: chrono
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:



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)

7041.patch (729 bytes) - added by viboes 5 years ago.

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by viboes

Attachment: 7041.patch added

comment:1 Changed 5 years ago by viboes

Status: newassigned

Please, could you tell me if the attached patch solves the issue when BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING is defined?

Last edited 5 years ago by viboes (previous) (diff)

comment:2 Changed 5 years ago by 1czajnik@…

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 Changed 5 years ago by viboes

Milestone: To Be DeterminedBoost 1.51.0

comment:4 Changed 5 years ago by viboes

Resolution: fixed
Status: assignedclosed

Committed revision 79371.

comment:5 Changed 5 years ago by viboes

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.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain viboes.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.