Chris@49: // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) Chris@49: // Copyright (C) 2008-2012 Conrad Sanderson Chris@49: // Chris@49: // This Source Code Form is subject to the terms of the Mozilla Public Chris@49: // License, v. 2.0. If a copy of the MPL was not distributed with this Chris@49: // file, You can obtain one at http://mozilla.org/MPL/2.0/. Chris@49: Chris@49: Chris@49: //! \addtogroup wall_clock Chris@49: //! @{ Chris@49: Chris@49: Chris@49: //! Class for measuring time intervals Chris@49: class wall_clock Chris@49: { Chris@49: public: Chris@49: Chris@49: inline wall_clock(); Chris@49: inline ~wall_clock(); Chris@49: Chris@49: inline void tic(); //!< start the timer Chris@49: inline double toc(); //!< return the number of seconds since the last call to tic() Chris@49: Chris@49: Chris@49: private: Chris@49: Chris@49: bool valid; Chris@49: Chris@49: #if defined(ARMA_USE_BOOST_DATE) Chris@49: boost::posix_time::ptime boost_time1; Chris@49: boost::posix_time::time_duration boost_duration; Chris@49: #elif defined(ARMA_HAVE_GETTIMEOFDAY) Chris@49: struct timeval posix_time1; Chris@49: struct timeval posix_time2; Chris@49: #else Chris@49: clock_t time1; Chris@49: #endif Chris@49: Chris@49: }; Chris@49: Chris@49: Chris@49: //! @}