Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Simple Network Time Protocol API. More...
Data Structures | |
struct | sntp_ctx |
struct | sntp_time |
Functions | |
int | sntp_init (struct sntp_ctx *ctx, struct sockaddr *addr, socklen_t addr_len) |
Initialize SNTP context. More... | |
int | sntp_query (struct sntp_ctx *ctx, uint32_t timeout, struct sntp_time *time) |
Perform SNTP query. More... | |
void | sntp_close (struct sntp_ctx *ctx) |
Release SNTP context. More... | |
int | sntp_simple (const char *server, uint32_t timeout, struct sntp_time *time) |
Convenience function to query SNTP in one-shot fashion. More... | |
Simple Network Time Protocol API.
#include <include/net/sntp.h>
Initialize SNTP context.
ctx | Address of sntp context. |
addr | IP address of NTP/SNTP server. |
addr_len | IP address length of NTP/SNTP server. |
#include <include/net/sntp.h>
Perform SNTP query.
ctx | Address of sntp context. |
timeout | Timeout of waiting for sntp response (in milliseconds). |
time | Timestamp including integer and fractional seconds since 1 Jan 1970 (output). |
#include <include/net/sntp.h>
Convenience function to query SNTP in one-shot fashion.
Convenience wrapper which calls getaddrinfo(), sntp_init(), sntp_query(), and sntp_close().
server | Address of server in format addr[:port] |
timeout | Query timeout |
time | Timestamp including integer and fractional seconds since 1 Jan 1970 (output). |