userver
C++ Async Framework
Toggle main menu visibility
Documentation
API Groups
Namespaces
Reference
Class List
Class Index
File List
Macros
All
e
i
l
r
t
u
Functions
Macros
e
i
l
r
t
u
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
timepoint_tz.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/utils/datetime/timepoint_tz.hpp
4
/// @brief Timepoint with timezone
5
/// @ingroup userver_universal
6
7
#
include
<
chrono
>
8
#
include
<
string
>
9
10
#
include
<
userver
/
logging
/
log_helper_fwd
.
hpp
>
11
12
USERVER_NAMESPACE_BEGIN
13
14
namespace
utils
::
datetime
{
15
16
class
TimePointTzBase
{
17
public
:
18
using
TimePoint = std::chrono::system_clock::time_point;
19
20
constexpr
TimePointTzBase() =
default
;
21
constexpr
explicit
TimePointTzBase(TimePoint tp) : tp_(tp) {}
22
constexpr
TimePointTzBase(TimePoint tp, std::chrono::seconds tz_offset) : tp_(tp), tz_offset_(tz_offset) {}
23
TimePointTzBase(
const
TimePointTzBase
& other);
24
TimePointTzBase(
TimePointTzBase
&& other)
noexcept
;
25
26
TimePointTzBase
& operator=(
const
TimePointTzBase
& other);
27
TimePointTzBase
& operator=(
TimePointTzBase
&& other)
noexcept
;
28
29
// Deliberately no 'explicit' to be compatible with legacy util/swaggen's
30
// plain time_point types
31
operator TimePoint()
const
;
32
33
/// Get timezone in seconds (may be negative)
34
std::chrono::seconds
GetTzOffset
()
const
;
35
36
/// Get std's time_point
37
TimePoint
GetTimePoint
()
const
;
38
39
bool
operator==(
const
TimePointTzBase
& other)
const
;
40
41
bool
operator<(
const
TimePointTzBase
& other)
const
;
42
43
bool
operator>(
const
TimePointTzBase
& other)
const
;
44
45
bool
operator<=(
const
TimePointTzBase
& other)
const
;
46
47
bool
operator>=(
const
TimePointTzBase
& other)
const
;
48
49
private
:
50
TimePoint tp_{};
51
std::chrono::seconds tz_offset_{};
52
};
16
class
TimePointTzBase
{
…
};
53
54
bool
operator<(
const
TimePointTzBase
::TimePoint& lhs,
const
TimePointTzBase
& rhs);
55
56
bool
operator>(
const
TimePointTzBase
::TimePoint& lhs,
const
TimePointTzBase
& rhs);
57
58
bool
operator<=(
const
TimePointTzBase
::TimePoint& lhs,
const
TimePointTzBase
& rhs);
59
60
bool
operator>=(
const
TimePointTzBase
::TimePoint& lhs,
const
TimePointTzBase
& rhs);
61
62
/// Timepoint with timezone parsed in kRfc3339Format
63
class
TimePointTz
final
:
public
TimePointTzBase
{
64
using
TimePointTzBase
::TimePointTzBase;
65
66
explicit
TimePointTz(
const
std::string& timestring);
67
};
63
class
TimePointTz
final
:
public
TimePointTzBase
{
…
};
68
69
logging
::LogHelper& operator<<(
logging
::LogHelper& os,
const
TimePointTz& v);
70
71
/// Timepoint with timezone parsed in kDefaultFormat
72
class
TimePointTzIsoBasic
final
:
public
TimePointTzBase
{
73
using
TimePointTzBase
::TimePointTzBase;
74
75
explicit
TimePointTzIsoBasic(
const
std::string& timestring);
76
};
72
class
TimePointTzIsoBasic
final
:
public
TimePointTzBase
{
…
};
77
78
logging
::LogHelper& operator<<(
logging
::LogHelper& os,
const
TimePointTzIsoBasic& v);
79
80
}
// namespace utils::datetime
81
82
USERVER_NAMESPACE_END
userver
utils
datetime
timepoint_tz.hpp
Generated on Wed Apr 30 2025 16:00:16 for userver by
Doxygen
1.13.2