123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #ifndef BOOST_TIMER_HPP
- #define BOOST_TIMER_HPP
- #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
|