#include </data/code/userver/libraries/proto-structs/include/userver/proto-structs/time_of_day.hpp>
Type to represent google.type.TimeOfDay in proto structs.
This type is organized in the same way as its protobuf counterpart and allows for the same range of values described here https://github.com/googleapis/googleapis/blob/master/google/type/timeofday.proto : from 00:00:00.0 to 24:00:00.0 inclusive, with leap seconds support (represented as value 60 for seconds).
Definition at line 42 of file time_of_day.hpp.
Public Types | |
| using | ProtobufMessage = ::google::type::TimeOfDay |
Public Member Functions | |
| constexpr | TimeOfDay ()=default |
Creates 00:00:00.0 time of the day. | |
| constexpr | TimeOfDay (const std::chrono::hours &hours, const std::chrono::minutes &minutes, const std::chrono::seconds &seconds, const std::chrono::nanoseconds &nanos=std::chrono::nanoseconds{0}) |
| Creates time of the day from components. | |
| template<typename TRep, typename TPeriod> | |
| constexpr | TimeOfDay (const std::chrono::hh_mm_ss< std::chrono::duration< TRep, TPeriod > > &hms) |
| Creates time of the day. | |
| template<typename TRep, typename TPeriod> | |
| constexpr | TimeOfDay (const utils::datetime::TimeOfDay< std::chrono::duration< TRep, TPeriod > > &time_of_day) noexcept |
| Creates time of the day. | |
| template<typename TRep, typename TPeriod> | |
| constexpr | TimeOfDay (std::chrono::duration< TRep, TPeriod > duration) |
| Creates time of the day from the duration. | |
| constexpr | TimeOfDay (const std::chrono::system_clock::time_point &time_point) noexcept |
| Creates time of the day evaluating it since the midnight before time_point. | |
| TimeOfDay (utils::impl::InternalTag, std::int32_t hours, std::int32_t minutes, std::int32_t seconds, std::int32_t nanos) | |
| constexpr const std::chrono::hours & | Hours () const noexcept |
Returns hours (from 0 to 24). | |
| constexpr const std::chrono::minutes & | Minutes () const noexcept |
Returns minutes (from 0 to 59). | |
| constexpr const std::chrono::seconds & | Seconds () const noexcept |
Returns seconds (from 0 to 59 in most cases, however 60 is also valid to support APIs with leap-seconds support). | |
| constexpr const std::chrono::nanoseconds & | Nanos () const noexcept |
Returns nanoseconds (from 0 to 999'999'999). | |
| template<typename TDuration = std::chrono::nanoseconds> | |
| requires ::meta::kIsInstantiationOf< std::chrono::duration, TDuration > constexpr std::chrono::hh_mm_ss< TDuration > | ToChronoTimeOfDay () const noexcept |
Converts time of the day to std::chrono::hh_mm_ss. | |
| template<typename TDuration = std::chrono::nanoseconds> | |
| requires ::meta::kIsInstantiationOf< std::chrono::duration, TDuration > constexpr TDuration | ToChronoDuration () const noexcept |
Converts time of the day to std::chrono::duration. | |
| template<typename TDuration = std::chrono::nanoseconds> | |
| requires ::meta::kIsInstantiationOf< std::chrono::duration, TDuration > constexpr utils::datetime::TimeOfDay< TDuration > | ToUserverTimeOfDay () const noexcept |
Converts time of the day to userver::utils::datetime::TimeOfDay. | |
| constexpr Duration | ToUserverDuration () const noexcept |
Converts time of the day to userver::proto_structs::Duration. | |
| template<typename TTimeOfDay> | |
| requires ::meta::kIsInstantiationOf< std::chrono::hh_mm_ss, TTimeOfDay > constexpr | operator TTimeOfDay () const noexcept |
Explicit conversion to std::chrono::hh_mm_ss. | |
| template<typename TDuration = std::chrono::nanoseconds> | |
| requires ::meta::kIsInstantiationOf< std::chrono::duration, TDuration > constexpr | operator TDuration () const noexcept |
Explicit conversion to std::chrono::duration. | |
| template<typename TTimeOfDay> | |
| requires ::meta::kIsInstantiationOf< utils::datetime::TimeOfDay, TTimeOfDay > constexpr | operator TTimeOfDay () const noexcept |
Explicit conversion to userver::utils::datetime::TimeOfDay. | |
| constexpr | operator Duration () const noexcept |
Explicit conversion to userver::proto_structs::Duration. | |
| auto | operator<=> (const TimeOfDay &) const =default |
| Default three-way comparison operator. | |
Static Public Member Functions | |
| template<typename TRep, typename TPeriod> | |
| static constexpr bool | IsValid (const std::chrono::hours &hours, const std::chrono::minutes &minutes, const std::chrono::seconds &seconds, const std::chrono::duration< TRep, TPeriod > &subseconds) noexcept |
Returns true if all components represent a valid google.type.TimeOfDay value. | |
| using proto_structs::TimeOfDay::ProtobufMessage = ::google::type::TimeOfDay |
Definition at line 44 of file time_of_day.hpp.
|
inlineconstexpr |
Creates time of the day from components.
| ValueError | if some component is outside the allowed range:
|
Definition at line 55 of file time_of_day.hpp.
|
inlineconstexpr |
Creates time of the day.
| ValueError | if hms is outside the allowed range. |
60). Use overload which explicitly accepts components of the time of the day. Definition at line 72 of file time_of_day.hpp.
|
inlineconstexprnoexcept |
Creates time of the day.
Definition at line 86 of file time_of_day.hpp.
|
inlineexplicitconstexpr |
Creates time of the day from the duration.
| ValueError | if duration is out of range. |
Definition at line 98 of file time_of_day.hpp.
|
inlineexplicitconstexprnoexcept |
Creates time of the day evaluating it since the midnight before time_point.
Definition at line 116 of file time_of_day.hpp.
|
inlinenodiscardconstexprnoexcept |
Returns hours (from 0 to 24).
Special value 24 may be use in scenarios like business closing time.
Definition at line 130 of file time_of_day.hpp.
|
inlinestaticnodiscardconstexprnoexcept |
Returns true if all components represent a valid google.type.TimeOfDay value.
Definition at line 199 of file time_of_day.hpp.
|
inlinenodiscardconstexprnoexcept |
Returns minutes (from 0 to 59).
Definition at line 133 of file time_of_day.hpp.
|
inlinenodiscardconstexprnoexcept |
Returns nanoseconds (from 0 to 999'999'999).
Definition at line 140 of file time_of_day.hpp.
|
inlineexplicitnodiscardconstexprnoexcept |
Explicit conversion to userver::proto_structs::Duration.
Definition at line 190 of file time_of_day.hpp.
|
inlineexplicitnodiscardconstexprnoexcept |
Explicit conversion to std::chrono::duration.
Definition at line 178 of file time_of_day.hpp.
|
inlineexplicitnodiscardconstexprnoexcept |
Explicit conversion to std::chrono::hh_mm_ss.
Definition at line 171 of file time_of_day.hpp.
|
inlineexplicitnodiscardconstexprnoexcept |
Explicit conversion to userver::utils::datetime::TimeOfDay.
Definition at line 185 of file time_of_day.hpp.
|
inlinenodiscardconstexprnoexcept |
Returns seconds (from 0 to 59 in most cases, however 60 is also valid to support APIs with leap-seconds support).
Definition at line 137 of file time_of_day.hpp.
|
inlinenodiscardconstexprnoexcept |
Converts time of the day to std::chrono::duration.
Definition at line 152 of file time_of_day.hpp.
|
inlinenodiscardconstexprnoexcept |
Converts time of the day to std::chrono::hh_mm_ss.
Definition at line 145 of file time_of_day.hpp.
|
inlinenodiscardconstexprnoexcept |
Converts time of the day to userver::proto_structs::Duration.
Definition at line 164 of file time_of_day.hpp.
|
inlinenodiscardconstexprnoexcept |
Converts time of the day to userver::utils::datetime::TimeOfDay.
Definition at line 159 of file time_of_day.hpp.