
Hello, 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 date_chrono::time_point<SystemClock,duration> time_point; static bool const is_monotonic = false; static time_point now(); }; Now, for this to work I obviously need to #include <boost/chrono/time_point.hpp>. Including it causes a dependency on Boost.System, making me have to link with it. But since I don't use any clocks provided by Boost.Chrono, I think the dependency on Boost.System is unnecessary. In fact, I was able to get rid of the dependency, and everything seems to work. I commented out 1 line from <boost/chrono/time_point.hpp>: //#include <boost/chrono/detail/system.hpp> Could this #include be removed from time_point.hpp, or is it needed for something I am not using ATM? Regards, Kris

Le 27/06/12 14:15, Krzysztof Czainski a écrit :
Hello,
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 date_chrono::time_point<SystemClock,duration> time_point; I gues you mean chrono:: and not date::chrono:: static bool const is_monotonic = false; is_monotonic is not used any more. You should use is_steady. static time_point now(); };
Now, for this to work I obviously need to #include <boost/chrono/time_point.hpp>. Including it causes a dependency on Boost.System, making me have to link with it. But since I don't use any clocks provided by Boost.Chrono, I think the dependency on Boost.System is unnecessary. From the documentation "
Don't provide Hybrid Error Handling When |BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING| is defined the lib don't provides the hybrid error handling prototypes: Clock::time_point Clock::now(system::error_code&ec=boost::thows()); This allow to be closer to the standard and to avoid the Boost.System dependency, making possible to have Boost.Chrono as a header-only library." Unfortunately, when this macro is defined the include to <boost/system/error_code.hpp> is yet done. I will fix it.
In fact, I was able to get rid of the dependency, and everything seems to work. I commented out 1 line from<boost/chrono/time_point.hpp>: //#include<boost/chrono/detail/system.hpp>
Could this #include be removed from time_point.hpp, or is it needed for something I am not using ATM?
See below. Please, could you create a Trac ticket? Best, Vicente

2012/6/27 Vicente J. Botet Escriba <vicente.botet@wanadoo.fr>
Le 27/06/12 14:15, Krzysztof Czainski a écrit :
Hello,
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 date_chrono::time_point<**SystemClock,duration> time_point;
I gues you mean chrono:: and not date::chrono::
Yes, that's a copy-paste leftover.
static bool const is_monotonic = false;
is_monotonic is not used any more. You should use is_steady.
Ok, thanks for the info. I based this design on boost-1.48 docs. [...]
From the documentation "
Don't provide Hybrid Error Handling
When |BOOST_CHRONO_DONT_PROVIDE_**HYBRID_ERROR_HANDLING| is defined the lib don't provides the hybrid error handling prototypes:
Clock::time_point Clock::now(system::error_code&**ec=boost::thows());
This allow to be closer to the standard and to avoid the Boost.System dependency, making possible to have Boost.Chrono as a header-only library."
Unfortunately, when this macro is defined the include to <boost/system/error_code.hpp> is yet done. I will fix it.
Thanks. [...]
Please, could you create a Trac ticket?
Ok, I will do that. Cheers, Kris

2012/6/28 Krzysztof Czainski <1czajnik@gmail.com>
2012/6/27 Vicente J. Botet Escriba <vicente.botet@wanadoo.fr>
Please, could you create a Trac ticket?
Ticket no. 7041.
Kris.
Hi, Thanks for fixing #7041, Vicente. However, I would like to repeat my question, why would you want <boost/chrono/detail/system.hpp> #included in time_point.hpp? I don't see any use of it. I 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

Le 09/07/12 09:27, Krzysztof Czainski a écrit :
2012/6/28 Krzysztof Czainski <1czajnik@gmail.com>
2012/6/27 Vicente J. Botet Escriba <vicente.botet@wanadoo.fr>
Please, could you create a Trac ticket? Ticket no. 7041. Kris.
Hi,
Thanks for fixing #7041, Vicente.
However, I would like to repeat my question, why would you want <boost/chrono/detail/system.hpp> #included in time_point.hpp? I don't see any use of it.
I think time_point.hpp should *not* depend on Boost.System regardless of #defining BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING. Am I missing something?
You are right. I didn't understood what you meant. I will commit it today. Best, Vicente
participants (2)
-
Krzysztof Czainski
-
Vicente J. Botet Escriba