cvd/timer.h

00001 /*                       
00002     This file is part of the CVD Library.
00003 
00004     Copyright (C) 2005 The Authors
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Lesser General Public
00008     License as published by the Free Software Foundation; either
00009     version 2.1 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Lesser General Public License for more details.
00015 
00016     You should have received a copy of the GNU Lesser General Public
00017     License along with this library; if not, write to the Free Software
00018     Foundation, Inc., 
00019     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 */
00022 // 
00023 // A timer class designed for dealing with timestamps
00024 // CK Nov 2002
00025 //
00027 
00028 #ifndef __CVD_TIMER_H
00029 #define __CVD_TIMER_H
00030 
00031 struct timeval;
00032 
00033 namespace CVD {
00034 
00041 class cvd_timer 
00042 {
00043     public:
00045         cvd_timer();
00047         double get_time();
00048 
00052         double conv_ntime(signed long long time);  
00053 
00057         double conv_ntime(const struct timeval& tv);
00058 
00061         double conv_ntime(const double time) const {
00062             return time - startTime * 1.e-6;
00063         }
00064 
00066         double reset();                       
00067 
00068 
00069     private:
00070         unsigned long long startTime;
00071 };
00072  
00075 extern cvd_timer timer;
00076 
00079 double get_time_of_day();
00080 
00081  
00082 }
00083 
00084 #endif

Generated on Wed Feb 18 10:23:02 2009 for CVD by  doxygen 1.5.3