/proc/self/cwd/test/test_common/test_time.cc
Line | Count | Source (jump to first uncovered line) |
1 | | #include "test/test_common/test_time.h" |
2 | | |
3 | | #include "source/common/common/utility.h" |
4 | | |
5 | | #include "test/test_common/global.h" |
6 | | |
7 | | namespace Envoy { |
8 | | |
9 | 3.01k | DangerousDeprecatedTestTime::DangerousDeprecatedTestTime() = default; |
10 | | |
11 | | namespace Event { |
12 | | |
13 | 5.38M | TestTimeSystem& GlobalTimeSystem::timeSystem() { |
14 | | // TODO(#4160): Switch default to SimulatedTimeSystem. |
15 | 5.38M | auto make_real_time_system = []() -> std::unique_ptr<TestTimeSystem> { |
16 | 2.01k | return std::make_unique<TestRealTimeSystem>(); |
17 | 2.01k | }; |
18 | 5.38M | return singleton_->timeSystem(make_real_time_system); |
19 | 5.38M | } |
20 | | |
21 | 26 | void TestRealTimeSystem::advanceTimeWaitImpl(const Duration& duration) { |
22 | 26 | only_one_thread_.checkOneThread(); |
23 | 26 | std::this_thread::sleep_for(duration); |
24 | 26 | } |
25 | | |
26 | 0 | void TestRealTimeSystem::advanceTimeAsyncImpl(const Duration& duration) { |
27 | 0 | advanceTimeWait(duration); |
28 | 0 | } |
29 | | |
30 | 35.4k | SystemTime TestRealTimeSystem::systemTime() { return real_time_system_.systemTime(); } |
31 | | |
32 | 240k | MonotonicTime TestRealTimeSystem::monotonicTime() { return real_time_system_.monotonicTime(); } |
33 | | |
34 | | } // namespace Event |
35 | | } // namespace Envoy |