Run NTP client in the background

This commit is contained in:
Dan Paulat 2025-08-22 20:04:21 -05:00
parent 63e6ba7709
commit 88d968a533
6 changed files with 54 additions and 1 deletions

View file

@ -26,7 +26,9 @@ public:
bool error();
std::chrono::system_clock::duration time_offset() const;
void Start();
void Start();
void Stop();
void Open(std::string_view host, std::string_view service);
void OpenCurrentServer();
void Poll();

View file

@ -191,6 +191,14 @@ void NtpClient::Start()
}
}
void NtpClient::Stop()
{
p->enabled_ = false;
p->socket_.cancel();
p->pollTimer_.cancel();
p->threadPool_.join();
}
void NtpClient::Open(std::string_view host, std::string_view service)
{
p->Open(host, service);