snark
timer.h
1 // This file is part of snark, a generic and flexible library
2 // for robotics research.
3 //
4 // Copyright (C) 2011 The University of Sydney
5 //
6 // snark is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 3 of the License, or (at your option) any later version.
10 //
11 // snark is distributed in the hope that it will be useful, but WITHOUT ANY
12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14 // for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with snark. If not, see <http://www.gnu.org/licenses/>.
18 
19 #ifndef SNARK_TIMING_TIMER_H_
20 #define SNARK_TIMING_TIMER_H_
21 
22 #include <boost/date_time/posix_time/posix_time.hpp>
23 #include <boost/thread/thread_time.hpp>
24 
25 namespace snark {
26 
28 class timer
29 {
30 public:
31  timer( const boost::posix_time::time_duration& duration );
32  void reset();
33  bool expired() const;
34 private:
35  boost::posix_time::time_duration m_duration;
36  boost::posix_time::ptime m_end;
37 };
38 
39 } // namespace snrk {
40 
41 #endif /*SNARK_TIMING_TIMER_H_*/