Xclox
C++11 header-only cross-platform date and time library with an asynchronous NTP client
|
QuerySeries is an ephemeral class representing a series of NTP queries. More...
#include <query_series.hpp>
Public Types | |
Aliases | |
using | Callback = QuerySingle::Callback |
Type of query callback. | |
using | DefaultTimeout = internal::DefaultTimeout< QuerySingle, 5000 > |
Type of query timeout milliseconds holder. | |
Public Member Functions | |
QuerySeries (asio::io_context &io, const asio::ip::udp::resolver::results_type &endpoints, const std::chrono::milliseconds &timeout) | |
Constructs a NTP query series on the given context that targets the given endpoints one at a time until success and runs within the given timeout duration. | |
void | cancel () |
Cancels the query reporting asio::error::operation_aborted to the caller. | |
Static Public Member Functions | |
static std::weak_ptr< QuerySeries > | start (asio::io_context &io, const asio::ip::udp::resolver::results_type &endpoints, Callback callback, const std::chrono::milliseconds &timeout=std::chrono::milliseconds(DefaultTimeout::ms)) |
Starts querying the given endpoints one at a time until success or all endpoints are queried. More... | |
QuerySeries is an ephemeral class representing a series of NTP queries.
|
inlinestatic |
Starts querying the given endpoints one at a time until success or all endpoints are queried.
io | a run context on which the operations of the query are executed. |
endpoints | a server address list to be queried. |
callback | a callable to report the result of the query to the caller. |
timeout | a time duration after which the query is cancelled if it is not completed. |