3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-03 22:05:45 +00:00

simplify timer.h

This commit is contained in:
Nuno Lopes 2019-02-21 13:57:38 +00:00
parent 3a7c467822
commit 85162d90d1
2 changed files with 18 additions and 50 deletions

View file

@ -19,21 +19,29 @@ Revision History:
#ifndef TIMER_H_
#define TIMER_H_
class stopwatch;
#include "util/stopwatch.h"
/**
\brief Wrapper for the stopwatch class. It hides windows.h dependency.
\brief Wrapper for the stopwatch class.
*/
class timer {
stopwatch * m_watch;
stopwatch m_watch;
public:
timer();
~timer();
void start();
double get_seconds();
bool timeout(unsigned secs) { return secs > 0 && secs != UINT_MAX && get_seconds() > secs; }
bool ms_timeout(unsigned ms) { return ms > 0 && ms != UINT_MAX && get_seconds() * 1000 > ms; }
void start() {
m_watch.start();
}
double get_seconds() const {
return m_watch.get_current_seconds();
}
bool timeout(unsigned secs) const {
return secs != 0 && secs != UINT_MAX && get_seconds() > secs;
}
bool ms_timeout(unsigned ms) const {
return ms != 0 && ms != UINT_MAX && get_seconds() * 1000 > ms;
}
};
#endif /* TIMER_H_ */