Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
 4.1.99
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sntp.h File Reference

SNTP (Simple Network Time Protocol) More...

Go to the source code of this file.

Data Structures

struct  sntp_time
 Time as returned by SNTP API, fractional seconds since 1 Jan 1970. More...
 
struct  sntp_ctx
 SNTP context. More...
 

Functions

int sntp_init (struct sntp_ctx *ctx, struct sockaddr *addr, socklen_t addr_len)
 Initialize SNTP context.
 
int sntp_query (struct sntp_ctx *ctx, uint32_t timeout, struct sntp_time *ts)
 Perform SNTP query.
 
int sntp_recv_response (struct sntp_ctx *ctx, uint32_t timeout, struct sntp_time *ts)
 Attempt to receive an SNTP response after issuing a query.
 
void sntp_close (struct sntp_ctx *ctx)
 Release SNTP context.
 
int sntp_init_async (struct sntp_ctx *ctx, struct sockaddr *addr, socklen_t addr_len, const struct net_socket_service_desc *service)
 Initialise SNTP context for async operation.
 
int sntp_send_async (struct sntp_ctx *ctx)
 Send the SNTP query.
 
int sntp_read_async (struct net_socket_service_event *event, struct sntp_time *ts)
 Read the result of the SNTP query.
 
void sntp_close_async (const struct net_socket_service_desc *service)
 Release SNTP context.
 
int sntp_simple (const char *server, uint32_t timeout, struct sntp_time *ts)
 Convenience function to query SNTP in one-shot fashion.
 
int sntp_simple_addr (struct sockaddr *addr, socklen_t addr_len, uint32_t timeout, struct sntp_time *ts)
 Convenience function to query SNTP in one-shot fashion using a pre-initialized address struct.
 

Detailed Description

SNTP (Simple Network Time Protocol)