MultiAgentDecisionProcess  Release 0.2.1
TimeTools.cpp
Go to the documentation of this file.
1 
28 #include "TimeTools.h"
29 
30 namespace TimeTools{
31 
32 double GetDeltaTimeDouble(timeval start_time, timeval cur_time)
33 {
34  if(gettimeofday(&cur_time, NULL) != 0)
35  throw "Error with gettimeofday";
36 
37  time_t delta_sec = cur_time.tv_sec - start_time.tv_sec;
38  suseconds_t delta_usec = cur_time.tv_usec - start_time.tv_usec;
39  double delta = 1000000.0 * delta_sec + delta_usec; //in microsecond
40  return delta;
41 }
42 
43 }
44 
45 
46