[chrono] chrono/config.hpp enforces that time.h defines CLOCK_REALTIME; should it?

Hello, Suppose I want to use durations, and time_points with a user defined clock. I don't want to use any clocks provided by Boost.Chrono. My compiler provides a <time.h>, which doesn't define CLOCK_REALTIME, which chrono/config.hpp reports as an error. This prevents me from using parts of Chrono, that I believe don't depend on anything from <time.h>. I am able to work around this by simply defining CLOCK_REALTIME. But I would like to ask: Could Boost.Chrono allow using duration.hpp and time_point.hpp in my case? Regards, Kris

Le 27/06/12 14:31, Krzysztof Czainski a écrit :
Hello,
Suppose I want to use durations, and time_points with a user defined clock. I don't want to use any clocks provided by Boost.Chrono.
My compiler provides a<time.h>, which doesn't define CLOCK_REALTIME, which chrono/config.hpp reports as an error. This prevents me from using parts of Chrono, that I believe don't depend on anything from<time.h>. chrono/config.hpp contains
# if defined( BOOST_CHRONO_POSIX_API ) # define BOOST_CHRONO_HAS_PROCESS_CLOCKS # include <time.h> //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME # if defined(CLOCK_REALTIME) # if defined(CLOCK_MONOTONIC) # define BOOST_CHRONO_HAS_CLOCK_STEADY # endif # else # error <time.h> does not supply CLOCK_REALTIME # endif ... # endif if CLOCK_REALTIME is not defined this means that we are unable to provide system_clock which is mandatory. This is why there is an error. Maybe this could only be included only when including system_clocks.hpp. Please could you make a feature request on the Trac system?
I am able to work around this by simply defining CLOCK_REALTIME. But I would like to ask: Could Boost.Chrono allow using duration.hpp and time_point.hpp in my case?
I think so, but you will need to try it. Best, Vicente

2012/6/27 Vicente J. Botet Escriba <vicente.botet@wanadoo.fr>
Le 27/06/12 14:31, Krzysztof Czainski a écrit :
Hello,
Suppose I want to use durations, and time_points with a user defined clock. I don't want to use any clocks provided by Boost.Chrono.
My compiler provides a<time.h>, which doesn't define CLOCK_REALTIME, which chrono/config.hpp reports as an error. This prevents me from using parts of Chrono, that I believe don't depend on anything from<time.h>.
chrono/config.hpp contains
# if defined( BOOST_CHRONO_POSIX_API ) # define BOOST_CHRONO_HAS_PROCESS_**CLOCKS # include <time.h> //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME # if defined(CLOCK_REALTIME) # if defined(CLOCK_MONOTONIC) # define BOOST_CHRONO_HAS_CLOCK_STEADY # endif # else # error <time.h> does not supply CLOCK_REALTIME # endif ... # endif
if CLOCK_REALTIME is not defined this means that we are unable to provide system_clock which is mandatory. This is why there is an error. Maybe this could only be included only when including system_clocks.hpp. Please could you make a feature request on the Trac system?
I don't need system_clock, while I would like to use time_point and duration. I will create a ticket then. Cheers, Kris

2012/6/28 Krzysztof Czainski <1czajnik@gmail.com>
2012/6/27 Vicente J. Botet Escriba <vicente.botet@wanadoo.fr>
Le 27/06/12 14:31, Krzysztof Czainski a écrit :
Hello,
Suppose I want to use durations, and time_points with a user defined clock. I don't want to use any clocks provided by Boost.Chrono.
My compiler provides a<time.h>, which doesn't define CLOCK_REALTIME, which chrono/config.hpp reports as an error. This prevents me from using parts of Chrono, that I believe don't depend on anything from<time.h>.
chrono/config.hpp contains
# if defined( BOOST_CHRONO_POSIX_API ) # define BOOST_CHRONO_HAS_PROCESS_**CLOCKS # include <time.h> //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME # if defined(CLOCK_REALTIME) # if defined(CLOCK_MONOTONIC) # define BOOST_CHRONO_HAS_CLOCK_STEADY # endif # else # error <time.h> does not supply CLOCK_REALTIME # endif ... # endif
if CLOCK_REALTIME is not defined this means that we are unable to provide system_clock which is mandatory. This is why there is an error. Maybe this could only be included only when including system_clocks.hpp. Please could you make a feature request on the Trac system?
I don't need system_clock, while I would like to use time_point and duration. I will create a ticket then.
Ticket no. 7042. Kris.
participants (2)
-
Krzysztof Czainski
-
Vicente J. Botet Escriba