userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
datetime.cpp
1
#
include
<
userver
/
protobuf
/
datetime
.
hpp
>
2
3
USERVER_NAMESPACE_BEGIN
4
5
namespace
protobuf {
6
7
bool
IsValidDuration
(
const
std::int64_t seconds,
const
std::int32_t nanos)
noexcept
{
8
if
(seconds < kMinDurationSeconds || seconds > kMaxDurationSeconds) {
9
return
false
;
10
}
11
12
if
(nanos < kMinDurationNanos || nanos > kMaxDurationNanos) {
13
return
false
;
14
}
15
16
if
((seconds > 0 && nanos < 0) || (seconds < 0 && nanos > 0)) {
17
return
false
;
18
}
19
20
return
true
;
21
}
22
23
bool
IsValidTimestamp
(
const
std::int64_t seconds,
const
std::int32_t nanos)
noexcept
{
24
if
(seconds < kMinTimestampSeconds || seconds > kMaxTimestampSeconds) {
25
return
false
;
26
}
27
28
if
(nanos < kMinTimestampNanos || nanos > kMaxTimestampNanos) {
29
return
false
;
30
}
31
32
return
true
;
33
}
34
35
}
// namespace protobuf
36
37
USERVER_NAMESPACE_END
protobuf
src
protobuf
datetime.cpp
Generated on
for userver by
Doxygen
1.17.0