#pragma once #include #include #define __asyncpp_has_impl_timer_now #include struct now_mock; static now_mock * __now_mock_instance; struct now_mock { public: inline now_mock() { __now_mock_instance = this; } inline ~now_mock() { if (__now_mock_instance == this) __now_mock_instance = nullptr; } public: MOCK_METHOD0(now, asyncpp::time_point()); }; namespace asyncpp { namespace timer { time_point now() { return __now_mock_instance ? __now_mock_instance->now() : std::chrono::steady_clock::now(); } } }