timehelp.C

Go to the documentation of this file.
00001 
00008 #ifdef HAVE_CONFIG_H
00009 #include <tumble-conf.h>
00010 #endif /* HAVE_CONFIG_H */
00011 
00012 #include "timehelp.h"
00013 #include <cstdlib>
00014 
00015 using namespace std;
00016 
00017 
00018 double elapsed_time_ms(const timeval& start){
00019     timeval now;
00020     gettimeofday(&now,NULL);
00021     return time_diff_ms(start, now);
00022 }
00023 
00024 double elapsed_time_sec(const timeval& start){
00025     timeval now;
00026     gettimeofday(&now,NULL);
00027     return time_diff_sec(start, now);
00028 }
00029 
00030 double time_diff_ms(const timeval& start, const timeval& end){
00031     return (end.tv_sec - start .tv_sec)*1.0E3 + (end.tv_usec - start.tv_usec)*1.0E-3;
00032 }
00033 
00034 double time_diff_sec(const timeval& start, const timeval& end){
00035     return (end.tv_sec - start .tv_sec) + (end.tv_usec - start.tv_usec)*1.0E-6;
00036 }

Generated on Mon May 24 09:53:30 2010 for TUMBLE by  doxygen 1.5.2