3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-16 05:48:44 +00:00
z3/src/util/timer.h
Nikolaj Bjorner d0e20e44ff booyah
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-07-04 15:56:30 -07:00

46 lines
689 B
C++

/*++
Copyright (c) 2006 Microsoft Corporation
Module Name:
timer.h
Abstract:
<abstract>
Author:
Leonardo de Moura (leonardo) 2009-01-06.
Revision History:
--*/
#pragma once
#include "util/stopwatch.h"
/**
\brief Wrapper for the stopwatch class.
*/
class timer {
stopwatch m_watch;
public:
timer() {
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;
}
};