// (C) 2024 by Folkert van Heusden // Released under MIT license #pragma once #include #include #include #include #include class ntp { private: std::atomic_bool stop { false }; std::mutex lock; std::string server; std::thread *th { nullptr }; uint32_t micros_at_ts { 0 }; uint64_t ntp_at_ts { 0 }; // us! public: ntp(const std::string & upstream_server); virtual ~ntp(); void begin(); std::optional get_unix_epoch_us(); void operator()(); };