userver
C++ Async Framework
Documentation
API Groups
Namespaces
Reference
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
w
y
Variables
k
n
r
u
w
Typedefs
c
d
h
m
n
o
p
s
t
u
v
Enumerations
a
b
c
d
f
h
i
l
o
p
r
s
t
u
v
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
Enumerations
Enumerator
Related Symbols
File List
File Members
All
e
i
l
r
t
u
Functions
Macros
e
i
l
r
t
u
Examples
Toggle main menu visibility
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
All results
mock_now.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/utils/mock_now.hpp
4
/// @brief Mocking and getting mocked time values
5
/// @ingroup userver_universal
6
7
#
include
<
chrono
>
8
9
USERVER_NAMESPACE_BEGIN
10
11
namespace
utils::
datetime
{
12
13
/// @cond
14
std::chrono::system_clock::time_point MockNow()
noexcept
;
15
16
std::chrono::steady_clock::time_point MockSteadyNow()
noexcept
;
17
///@endcond
18
19
/// Sets the mocked value for utils::datetime::Now() and
20
/// utils::datetime::SteadyNow().
21
///
22
/// Thread safe.
23
void
MockNowSet
(std::chrono::system_clock::time_point new_mocked_now);
24
25
/// Adds duration to current mocked time point value
26
///
27
/// Thread safe.
28
///
29
/// @throws utils::InvariantError if IsMockNow() returns false.
30
void
MockSleep
(std::chrono::milliseconds duration);
31
32
/// Removes time point mocking for utils::datetime::Now() and
33
/// utils::datetime::SteadyNow().
34
void
MockNowUnset
()
noexcept
;
35
36
/// Returns true if time point is mocked for utils::datetime::Now() and
37
/// utils::datetime::SteadyNow().
38
bool
IsMockNow
()
noexcept
;
39
40
}
// namespace utils::datetime
41
42
USERVER_NAMESPACE_END
userver
utils
mock_now.hpp
Generated on Wed May 15 2024 22:35:12 for userver by
Doxygen
1.10.0