Go to the documentation of this file.
30 # include <itpp/config.h>
32 # include <itpp/config_msvc.h>
35 #ifdef TIME_WITH_SYS_TIME
36 # include <sys/time.h>
39 # ifdef HAVE_SYS_TIME_H
40 # include <sys/time.h>
52 #if defined(_WIN32) && !defined(__CYGWIN__)
55 int gettimeofday(
struct timeval* p,
void*)
62 GetSystemTimeAsFileTime(&(_now.ft));
63 p->tv_usec = (long)((_now.ns100 / 10LL) % 1000000LL);
65 p->tv_sec = (long)((_now.ns100 - 116444736000000000LL) / 10000000LL);
132 std::cout <<
"Elapsed time = " <<
get_time() <<
" seconds" << std::endl;
140 return static_cast<double>(clock()) / CLOCKS_PER_SEC;
150 return t.tv_sec + t.tv_usec * 1.0e-6;
172 std::cout <<
"(Press enter to continue)" << std::endl;
double start_time
The start time of the timer.
Definitions of Timing classes.
void tic(void)
Resets the timer and starts it.
double toc()
Returns the elapsed time since last tic()
double elapsed_time
The ellapsed time from start to stop.
void toc_print(void)
Prints the elapsed time since last tic()
bool running
A bool that indicates if the timer is running or not.
virtual double get_current_time() const =0
Vitrual function that returns teh current time.
double get_current_time() const
Vitrual function that returns teh current time.
Timer()
Create a new timer. Sets the time to zero.
double get_time() const
Returns the elapsed time.
void start(void)
Start the timer. This does not set the time to zero.
double toc(void)
Returns the elapsed time since last tic()
double stop(void)
Stop the timer. Returns the elapsed time in seconds.
void toc_print()
Prints the elapsed time since last tic()
void pause(double t)
pause
void tic()
Reset and start timer.
void reset(double t=0.0)
Sets the time to time t, which is zero by default. Stops the timer if it is running.
double get_current_time() const
Vitrual function that returns teh current time.
Real_Timer __tic_toc_timer
Global object for tic and toc functions.
double stop_time
The stop time of the timer.
Generated on Sun Jan 3 2021 11:31:33 for IT++ by Doxygen 1.8.20