userver: userver/utils/string_to_duration.hpp Source File
Loading...
Searching...
No Matches
string_to_duration.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/utils/string_to_duration.hpp
4/// @brief @copybrief utils::StringToDuration
5/// @ingroup userver_universal
6
7#include <chrono>
8#include <string>
9
10USERVER_NAMESPACE_BEGIN
11
12namespace utils {
13
14/// @brief Converts strings like "10s", "5d", "1h" to durations
15///
16/// Understands the following suffixes:
17/// s - seconds
18/// ms - milliseconds
19/// m - minutes
20/// h - hours
21/// d - days
22std::chrono::milliseconds StringToDuration(const std::string& data);
23
24} // namespace utils
25
26USERVER_NAMESPACE_END