oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
net_sntp.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2026 Kamil Lulko <kamil.lulko@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 *
6 * This file is part of oveRTOS.
7 */
8
14#pragma once
15
16#include <ove/net_sntp.h>
17
18#ifdef CONFIG_OVE_NET_SNTP
19
20namespace ove {
21
26namespace sntp {
27
32struct Config {
33 const char *server{"pool.ntp.org"};
34 uint32_t timeout_ms{5000};
35};
36
42[[nodiscard]] inline int sync(const Config &cfg = {}) {
43 ove_sntp_config_t c{cfg.server, cfg.timeout_ms};
44 return ove_sntp_sync(&c);
45}
46
52[[nodiscard]] inline int get_offset_us(int64_t &offset_us) {
53 return ove_sntp_get_offset_us(&offset_us);
54}
55
61[[nodiscard]] inline int get_utc(uint32_t &utc_s) {
62 return ove_sntp_get_utc(&utc_s);
63}
64
65} /* namespace sntp */
66
67} // namespace ove
68
69#endif /* CONFIG_OVE_NET_SNTP */
Top-level namespace for all oveRTOS C++ abstractions.
Definition app.hpp:19