oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
net_sntp.h
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
9#ifndef OVE_NET_SNTP_H
10#define OVE_NET_SNTP_H
11
26#include "ove/types.h"
27#include "ove_config.h"
28
29#include <stdint.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
38typedef struct {
39 const char *server;
40 uint64_t timeout_ns;
42
43#ifdef CONFIG_OVE_NET_SNTP
44
55
65int ove_sntp_get_offset_us(int64_t *offset_us);
66
75int ove_sntp_get_utc(uint32_t *utc_s);
76
77#else /* !CONFIG_OVE_NET_SNTP */
78
80static inline int ove_sntp_sync(const ove_sntp_config_t *cfg)
81{
82 (void)cfg;
84}
85static inline int ove_sntp_get_offset_us(int64_t *o)
86{
87 (void)o;
89}
90static inline int ove_sntp_get_utc(uint32_t *u)
91{
92 (void)u;
94}
97#endif /* CONFIG_OVE_NET_SNTP */
98
99#ifdef __cplusplus
100}
101#endif
102
105#endif /* OVE_NET_SNTP_H */
int ove_sntp_sync(const ove_sntp_config_t *cfg)
Synchronize with an NTP server.
int ove_sntp_get_utc(uint32_t *utc_s)
Get the current UTC time in seconds since Unix epoch.
int ove_sntp_get_offset_us(int64_t *offset_us)
Get the UTC offset computed by the last successful sync.
@ OVE_ERR_NOT_SUPPORTED
Definition types.h:98
SNTP client configuration.
Definition net_sntp.h:38
const char * server
Definition net_sntp.h:39
uint64_t timeout_ns
Definition net_sntp.h:40