3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-15 05:18:44 +00:00
z3/src/util/timer.h
Martin Nowack 762e5fd093 Do not request time stamp if not needed
If no timeout is needed for solving queries, time stamps do not
need to be acquired.
2016-11-23 16:38:21 +01:00

40 lines
655 B
C++

/*++
Copyright (c) 2006 Microsoft Corporation
Module Name:
timer.h
Abstract:
<abstract>
Author:
Leonardo de Moura (leonardo) 2009-01-06.
Revision History:
--*/
#ifndef TIMER_H_
#define TIMER_H_
class stopwatch;
/**
\brief Wrapper for the stopwatch class. It hides windows.h dependency.
*/
class timer {
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; }
};
#endif /* TIMER_H_ */