10#include <cctz/time_zone.h>
12#include <userver/utils/datetime/cpp_20_calendar.hpp>
13#include <userver/utils/datetime_light.hpp>
15USERVER_NAMESPACE_BEGIN
21template <
class Duration = std::chrono::system_clock::duration>
22std::chrono::time_point<std::chrono::system_clock, Duration>
24 using TimePoint = std::chrono::time_point<std::chrono::system_clock, Duration>;
29 cctz::time_point<cctz::seconds> tp_seconds;
30 cctz::detail::femtoseconds femtoseconds;
31 if (!cctz::detail::parse(format, timestring, cctz::utc_time_zone(), &tp_seconds, &femtoseconds)) {
36 if (std::chrono::time_point_cast<Days>(tp_seconds) >= kTaxiInfinity ||
37 tp_seconds > std::chrono::time_point_cast<
decltype(tp_seconds)::duration>(TimePoint::max())) {
38 return TimePoint::max();
41 return std::chrono::time_point_cast<Duration>(tp_seconds) + std::chrono::duration_cast<Duration>(femtoseconds);
48template <
class Duration = std::chrono::system_clock::duration>