24 return (milliseconds / 1000.0);
37 return ( static_cast<std::size_t>( round(seconds * 1000) ) );
50 return ( static_cast<std::size_t>( std::floor(seconds * 1000) ) );
75 gettimeofday(&start_time, 0);
84 gettimeofday(&end_time, 0);
85 timediff = (
double) end_time.tv_sec - start_time.tv_sec
86 + 0.000001 * (end_time.tv_usec - start_time.tv_usec);
110 friend std::ostream& operator<< (std::ostream& out,
const Timer& timer)
112 std::ios state(NULL);
115 out << std::setiosflags(std::ios::fixed) << std::setprecision(6)
116 <<
"Timer value = " << timer.
timediff;
124 struct timeval start_time;
125 struct timeval end_time;
Timer()
Constructor. Starts the timer.
double HUMOTO_LOCAL convertMillisecondToSecond(const std::size_t milliseconds)
Converts milliseconds to seconds.
std::size_t HUMOTO_LOCAL convertSecondToMillisecond(const double seconds)
Converts seconds to milliseconds.
The root namespace of HuMoTo.
std::size_t HUMOTO_LOCAL truncateSecondToMillisecond(const double seconds)
Converts seconds to milliseconds (with truncation instead of rounding)
double stop()
Stops the timer.
void start()
Re/starts the timer.