Adoption can be performed via assertout <cassert>or static_assertwhich is built into the language.
So, why not take the time manually and then check the time difference in the expression assert?
#include <cassert>
#include <chrono>
#ifndef NDEBUG
auto start = std::chrono::high_resolution_clock::now();
#endif
...
#ifndef NDEBUG
assert(std::chrono::duration_cast<milliseconds>(
std::chrono::high_resolution_clock::now() - start).count() < 2000
);
#endif
, NDEBUG. assert , NDEBUG , .
, NDEBUG start, GCC __COUNTER__, ( ) , , , .