16#include <ove/net_sntp.h>
19#ifdef CONFIG_OVE_NET_SNTP
46 ove_sntp_config_t c{cfg.
server, cfg.timeout_ns};
47 return from_rc(ove_sntp_sync(&c));
58 int64_t offset_us = 0;
59 const int rc = ove_sntp_get_offset_us(&offset_us);
71 const int rc = ove_sntp_get_utc(&utc_s);
Strong ove::Error type, Result<T> alias, and std::error_code interop for the oveRTOS C++ binding.
C++ wrappers around the oveRTOS SNTP client API.
Definition net_sntp.hpp:22
Result< uint32_t > get_utc() noexcept
Get current UTC time in seconds since Unix epoch.
Definition net_sntp.hpp:68
Result< void > sync(const Config &cfg={}) noexcept
Synchronize with an NTP time server.
Definition net_sntp.hpp:44
Result< int64_t > get_offset_us() noexcept
Get the UTC offset from the last successful sync.
Definition net_sntp.hpp:56
Result< void > from_rc(int rc) noexcept
Lifts a substrate rc-code into a Result<void>.
Definition error.hpp:254
std::expected< T, Error > Result
std::expected-based result alias.
Definition error.hpp:139
SNTP client configuration with C++ defaults.
Definition net_sntp.hpp:33
uint64_t timeout_ns
Definition net_sntp.hpp:35
const char * server
Definition net_sntp.hpp:34