mock out fc::time_point::now() and provide a mock deadline timer
More...
#include <mock_time.hpp>
Definition at line 9 of file mock_time.hpp.
◆ duration_type
◆ time_type
◆ add()
Definition at line 25 of file mock_time.hpp.
25{ return source_traits::add( t, d ); }
◆ fc_now()
Definition at line 29 of file mock_time.cpp.
29 {
31}
static time_type now() noexcept
◆ is_set()
static bool fc::mock_time_traits::is_set |
( |
| ) |
|
|
inlinestatic |
◆ less_than()
Definition at line 27 of file mock_time.hpp.
27{ return source_traits::less_than( t1, t2 ); }
◆ now()
Definition at line 10 of file mock_time.cpp.
10 {
11 return epoch_ + boost::posix_time::microseconds( now_.load() );
12}
◆ set_now() [1/2]
Definition at line 19 of file mock_time.cpp.
19 {
20 now_ =
now.time_since_epoch().count();
21 if( !mock_enabled_ ) mock_enabled_ = true;
22
23
24
25
26 std::this_thread::sleep_for( std::chrono::milliseconds( 2 ) );
27}
◆ set_now() [2/2]
void fc::mock_time_traits::set_now |
( |
time_type | t | ) |
|
|
static |
Definition at line 14 of file mock_time.cpp.
14 {
17}
static void set_now(time_type t)
◆ subtract()
Definition at line 26 of file mock_time.hpp.
26{ return source_traits::subtract( t1, t2 ); }
◆ to_posix_duration()
static boost::posix_time::time_duration fc::mock_time_traits::to_posix_duration |
( |
duration_type | d | ) |
|
|
inlinestatic |
Definition at line 32 of file mock_time.hpp.
32 {
33 return d < boost::posix_time::milliseconds( 1 ) ?
d : boost::posix_time::milliseconds( 1 );
34 }
The documentation for this class was generated from the following files: