Opened 10 years ago

Closed 10 years ago

Last modified 10 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:

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)

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

Download all attachments as: .zip

Change History (6)

by viboes, 10 years ago

Attachment: 7041.patch added

comment:1 by viboes, 10 years ago

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 10 years ago by viboes (previous) (diff)

comment:2 by 1czajnik@…, 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 viboes, 10 years ago

Milestone: To Be DeterminedBoost 1.51.0

comment:4 by viboes, 10 years ago

Resolution: fixed
Status: assignedclosed

Committed revision 79371.

comment:5 by viboes, 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.

Note: See TracTickets for help on using tickets.