00001 /* 00002 * $Id: Chronometer.h 562 2007-12-02 08:04:16Z mindstorm2600 $ 00003 * 00004 * X-VR2 00005 * 00006 * Copyright (C) Juan V. Guerrero 2007 00007 * 00008 * Juan V. Guerrero <mindstorm2600@users.sourceforge.net> 00009 * 00010 * This program is free software, distributed under the terms of 00011 * the GNU General Public License Version 2. See the LICENSE file 00012 * at the top of the source tree. 00013 */ 00014 #ifndef __XVR2_CRONOMETER_H__ 00015 #define __XVR2_CRONOMETER_H__ 00016 00017 #include<xvr2/xvr2config.h> 00018 #include<xvr2/CoreExceptions.h> 00019 #include<xvr2/Time.h> 00020 #include<sys/types.h> 00021 00022 namespace xvr2{ 00026 class Chronometer:protected Time{ 00027 protected: 00028 struct timeval _startedOn; 00029 struct timeval _finishedOn; 00030 bool _counting; 00031 public: 00033 Chronometer(); 00036 void start(); 00038 void stop(); 00041 void resume(); 00043 void reset(); 00045 long int elapsedHour(); 00047 long int elapsedMinute(); 00049 long int elapsedSecond(); 00051 long int elapsedMillisecond(); 00053 long int elapsedMicrosecond(); 00054 }; 00055 } 00056 00057 #endif