12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #ifndef BOOST_TIMER_HPP
- #define BOOST_TIMER_HPP
- #if !defined(BOOST_TIMER_ENABLE_DEPRECATED)
- # error This header is deprecated and will be removed. (You can define BOOST_TIMER_ENABLE_DEPRECATED to suppress this error.)
- #endif
- #include <boost/config/header_deprecated.hpp>
- BOOST_HEADER_DEPRECATED( "the facilities in <boost/timer/timer.hpp>" )
- #include <boost/config.hpp>
- #include <ctime>
- #include <boost/limits.hpp>
- # ifdef BOOST_NO_STDC_NAMESPACE
- namespace std { using ::clock_t; using ::clock; }
- # endif
- namespace boost {
- class timer
- {
- public:
- timer() { _start_time = std::clock(); }
- void restart() { _start_time = std::clock(); }
- double elapsed() const
- { return double(std::clock() - _start_time) / CLOCKS_PER_SEC; }
- double elapsed_max() const
-
-
- {
- return (double((std::numeric_limits<std::clock_t>::max)())
- - double(_start_time)) / double(CLOCKS_PER_SEC);
- }
- double elapsed_min() const
- { return double(1)/double(CLOCKS_PER_SEC); }
- private:
- std::clock_t _start_time;
- };
- }
- #endif
|