3#include <xrpl/beast/clock/abstract_clock.h>
4#include <xrpl/beast/clock/manual_clock.h>
5#include <xrpl/beast/unit_test.h>
16 template <
class Clock>
22 auto const t1(c.
now());
24 auto const t2(c.
now());
26 log <<
"t1= " << t1.time_since_epoch().count()
27 <<
", t2= " << t2.time_since_epoch().count()
28 <<
", elapsed= " << (t2 - t1).count() <<
std::endl;
43 auto c1 = c.now().time_since_epoch();
45 auto c2 = c.now().time_since_epoch();
47 auto c3 = c.now().time_since_epoch();
49 log <<
"[" << c1.count() <<
"," << c2.count() <<
"," << c3.count()
58 test(
"steady_clock", get_abstract_clock<std::chrono::steady_clock>());
59 test(
"system_clock", get_abstract_clock<std::chrono::system_clock>());
61 "high_resolution_clock",
62 get_abstract_clock<std::chrono::high_resolution_clock>());
void run() override
Runs the suite.
void test(std::string name, abstract_clock< Clock > &c)
Abstract interface to a clock.
virtual time_point now() const =0
Returns the current time.
Manual clock implementation.
log_os< char > log
Logging output stream.
void pass()
Record a successful test condition.
testcase_t testcase
Memberspace for declaring test cases.