
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